Issue
I set up my own Jenkins and tried to get a project to build on it.
When I execute it from Jenkins i get the following log:
Parsing POMs
[workspace] $ /usr/local/java/jdk1.7.0_40/bin/java -Xmx512m -XX:MaxPermSize=128m -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.4.jar:/usr/share/maven/boot/plexus-classworlds-2.x.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven /var/cache/jenkins/war/WEB-INF/lib/remoting-2.32.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.4.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 53026
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/jobs/RecipeManager/workspace/pom.xml mvn clean install -Denvironment=ci -X -e
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.7.0_40/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Using local repository at /var/lib/jenkins/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /var/lib/jenkins/.m2/repository
Oct 14, 2013 11:09:43 PM org.apache.maven.cli.event.ExecutionEventLogger projectDiscoveryStarted
INFO: Scanning for projects...
[DEBUG] Extension realms for project de.recipeManager:RecipeManager:war:0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: de.recipeManager:RecipeManager:war:0.1-SNAPSHOT
[DEBUG] Tasks: [mvn, clean, install]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO:
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: ------------------------------------------------------------------------
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: Building RecipeManager 0.1-SNAPSHOT
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logResult
INFO: ------------------------------------------------------------------------
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logResult
INFO: BUILD FAILURE
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: ------------------------------------------------------------------------
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Total time: 0.621s
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Finished at: Mon Oct 14 23:09:44 CEST 2013
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Final Memory: 5M/15M
Oct 14, 2013 11:09:44 PM org.apache.maven.cli.event.ExecutionEventLogger sessionEnded
INFO: ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/jobs/RecipeManager/workspace/pom.xml to de.recipeManager/RecipeManager/0.1-SNAPSHOT/RecipeManager-0.1-SNAPSHOT.pom
Sending e-mails to: [email protected]
channel stopped
Sending e-mails to: [email protected]
Finished: FAILURE
I ran it with -X and -e to see the full output but I can't see where it breaks.
And if I add a post-build step and execute the following in the shell it works well:
cd /var/lib/jenkins/jobs/RecipeManager/workspace
mvn clean install -Denvironment=ci
My pom.xml looks like that and works well if it's executed without Jenkins:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.recipeManager</groupId>
<artifactId>RecipeManager</artifactId>
<packaging>war</packaging>
<version>0.1-SNAPSHOT</version>
<name>RecipeManager</name>
<url>http://maven.apache.org</url>
<properties>
<spring-version>3.2.3.RELEASE</spring-version>
<jetty-version>8.1.2.v20120308</jetty-version>
<java-version>1.7</java-version>
</properties>
<dependencies>
<!--Spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.2.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>0.8.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.7.0.RELEASE</version>
</dependency>
<!--Database:-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.2.3.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
<!--JSON Mapping-->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!--Tests-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
</plugin>
</plugins>
</build>
</project>
Does anyone understand the log?
Solution
I'd suggest trimming the project configuration down to the smallest number of steps possible, and make sure you know exactly what goals your "build" step is invoking (try "clean install" to start - currently it looks like it's failing in site-deploy - did you want it to run that? Does it have enough information to do the right thing there if you do?), get that working and then add things back.
Note also that Jenkins can fail the build because a post-build step failed. For example, if you have the "Archive the artifacts" checked but the build doesn't contain any artifacts that match, your build can still fail even if Maven succeeds.
Answered By - Tim Boudreau
Answer Checked By - Mildred Charles (JavaFixing Admin)