Jenkins Configuration(1)Setup on Redhat
JenkinsConfiguration(1)SetuponRedhat
1.ConfigurationonRedhat
IfollowthedocumentIwrotebeforetoinstallthejenkinsonmyredhatserver.AndItriedtochangesomeconfigurationonthat.
Commandtorestarttheserver:
>sudo/etc/init.d/jenkinsrestart
Placetochangetheportandserverlogplace
>vi/etc/sysconfig/jenkins
Maybe,someoneelseinstallthejenkinsbeforeonthatredhat,soIcannotloginontothatsystem.
Ifindaplacetochangethejenkinsuserconfiguration:
>cd/var/lib/jenkins/
>viconfig.xml
<authorizationStrategyclass="hudson.security.ProjectMatrixAuthorizationStrategy">
<permission>hudson.model.Hudson.Administer:my_google_account</permission>
</authorizationStrategy>
2.Updatemyjenkins
checktheversionofjenkinswhichIhave
>rpm-qa|grep-ijenkins
jenkins-1.437-1.1
>rpm-ejenkins
Installthejenkinsfromrpm
>sudowget-O/etc/yum.repos.d/jenkins.repohttp://pkg.jenkins-ci.org/redhat/jenkins.repo
>sudorpm--importhttp://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
>yuminstalljenkins
3.Begintoconfigureanewprojectfromgithub
configuredmaven,ant,jdkinmyjenkins.
Trytoinstallthepluginsforgit,theyareasfollow:
github-api
GithubAuthenticationplugin
JenkinsGITplugin
GitHubplugin
ButIgotthiserrormessage:
Failedtoconnecttorepository:Command"[email protected]:luohuazju/easy.gitHEAD"returnedstatuscode128:stdout:
stderr:Hostkeyverificationfailed.
fatal:Theremoteendhungupunexpectedly
Solution:
/var/lib/jenkins/.ssh
cpmyprivatekeytothatlocation.
AndthenIgeneratethekeywiththeuserroot,Ichangethejenkinsuserto'root'.Maybenexttime,Iwillgeneratethekeywithjenkinsuser.
[email protected]:luohuazju/easy.git.
ThenIcancreatetheprojectwhichfetchcodesfromgithub.
4.MaketheprojectworkwithJBOSS
ThisisfordeployonejarcorepackagetoJBOSSserverdefaultdeploydirectory.
…snip...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<jbossHome>/opt/jboss-as</jbossHome>
<serverName>default</serverName>
<fileName>target/${project.artifactId}-${project.version}.jar</fileName>
</configuration>
</plugin>
</plugins>
</build>
…snip…
Thecommandwillbe
>mvncleanpackageinstalljboss:hard-deploy
Andthisisforthewebproject,wewilldeployawarpackagetothejbossdeploydirectory.
<build>
<finalName>easyrestserver</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/lib/easyapi-1.0.jar,WEB-INF/classes/config.properties,WEB-INF/classes/log4j.properties</packagingExcludes>
<warSourceExcludes>index.jsp</warSourceExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8</version>
<configuration]]>
<printSummary]]>false</printSummary]]>
<redirectTestOutputToFile]]>true</redirectTestOutputToFile]]>
<excludes]]>
<exclude]]>**/*_Roo_*</exclude]]>
</excludes]]>
</configuration]]>
</plugin]]>
<plugin]]>
<groupId]]>org.apache.maven.plugins</groupId]]>
<artifactId]]>maven-assembly-plugin</artifactId]]>
<version]]>2.2.1</version]]>
<configuration]]>
<descriptorRefs]]>
<descriptorRef]]>jar-with-dependencies</descriptorRef]]>
</descriptorRefs]]>
</configuration]]>
</plugin]]>
<plugin]]>
<groupId]]>org.apache.maven.plugins</groupId]]>
<artifactId]]>maven-deploy-plugin</artifactId]]>
<version]]>2.6</version]]>
</plugin]]>
<!--IDE-->
<plugin]]>
<groupId]]>org.apache.maven.plugins</groupId]]>
<artifactId]]>maven-eclipse-plugin</artifactId]]>
<version]]>2.7</version]]><!--Note2.8doesnotworkwithAspectJaspectpath-->
<configuration]]>
<downloadSources]]>true</downloadSources]]>
<downloadJavadocs]]>false</downloadJavadocs]]>
<wtpversion]]>2.0</wtpversion]]>
<additionalBuildcommands]]>
<buildCommand]]>
<name]]>org.eclipse.ajdt.core.ajbuilder</name]]>
<arguments]]>
<aspectPath]]>org.springframework.aspects</aspectPath]]>
</arguments]]>
</buildCommand]]>
<buildCommand]]>
<name]]>org.springframework.ide.eclipse.core.springbuilder</name]]>
</buildCommand]]>
</additionalBuildcommands]]>
<additionalProjectnatures]]>
<projectnature]]>org.eclipse.ajdt.ui.ajnature</projectnature]]>
<projectnature]]>com.springsource.sts.roo.core.nature
</projectnature]]>
<projectnature]]>org.springframework.ide.eclipse.core.springnature
</projectnature]]>
</additionalProjectnatures]]>
</configuration]]>
</plugin]]>
<plugin]]>
<groupId]]>org.apache.maven.plugins</groupId]]>
<artifactId]]>maven-idea-plugin</artifactId]]>
<version]]>2.2</version]]>
<configuration]]>
<downloadSources]]>true</downloadSources]]>
<dependenciesAsLibraries]]>true</dependenciesAsLibraries]]>
</configuration]]>
</plugin]]>
<plugin]]>
<groupId]]>org.codehaus.mojo</groupId]]>
<artifactId]]>tomcat-maven-plugin</artifactId]]>
<version]]>1.1</version]]>
</plugin]]>
<plugin]]>
<groupId]]>org.mortbay.jetty</groupId]]>
<artifactId]]>jetty-maven-plugin</artifactId]]>
<version]]>7.4.2.v20110526</version]]>
<configuration]]>
<webAppConfig]]>
<contextPath]]>/${project.name}</contextPath]]>
</webAppConfig]]>
</configuration]]>
</plugin]]>
<plugin]]>
<groupId]]>org.codehaus.mojo</groupId]]>
<artifactId]]>jboss-maven-plugin</artifactId]]>
<version]]>1.5.0</version]]>
<configuration]]>
<jbossHome]]>/opt/jboss-as</jbossHome]]>
<serverName]]>default</serverName]]>
<unpack]]>false</unpack]]>
</configuration]]>
</plugin]]>
</plugins]]>
</build]]>
Thecommandwillbe
>mvncleanpackagejboss:hard-deploy
references: