我有一个maven jenkins项目。
构建作业失败,因为maven“错误:找不到符号xy”。
如果我运行手动,jenkins workspave中的构建一切都很好。
使用控制台进行mvn clean安装 - 在jenkins szerver作业目录中:
....
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:02.841s
[INFO] Finished at: Mon Oct 13 15:16:35 CEST 2014
[INFO] Final Memory: 38M/363M
[INFO] ------------------------------------------------------------------------
使用jenkins job mvn clean install:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.269s
[INFO] Finished at: Mon Oct 13 15:17:46 CEST 2014
[INFO] Final Memory: 27M/242M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project rtt-backend: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/workspace/NewRTT_BackEnd/src/main/java/hu/test/rtt/backend/login/LoginController.java:[9,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
我检查文件所有权,检查日志等。
该项目在本地PC上运行良好。
Mvn版本: Apache Maven 3.0.4 Java版本: Java版本:1.8.0_20,供应商:Oracle Corporation
这个错误的原因是什么?
更新
我使用SVN repo和10分钟民意调查
Logincontroller.java:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
....
错误日志
[Demo backend - Poll] $ /usr/lib/jvm/java-8-oracle/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.5.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.46.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.5.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 47998
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/Demo backend - Poll/pom.xml clean install -Pdev,skipDBTests
[INFO] Scanning for projects...
[HUDSON] Collecting dependencies info
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rtm-backend 0.1.9
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ rtm-backend ---
[INFO] Deleting file set: /var/lib/jenkins/workspace/Demo backend - Poll/target (included: [**], excluded: [])
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) @ rtm-backend ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (default) @ rtm-backend ---
[INFO] argLine set to "-javaagent:/var/lib/jenkins/.m2/repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=/var/lib/jenkins/workspace/Demo backend - Poll/target/jacoco.exec"
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) @ rtm-backend ---
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ rtm-backend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 2 resources
[INFO] Copying 9 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ rtm-backend ---
[INFO] Compiling 138 source files to /var/lib/jenkins/workspace/Demo backend - Poll/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportitems/ReportItemsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportitems/ReportItemsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportmembers/ReportMembersController.java:[10,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportmembers/ReportMembersController.java:[12,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/tracking/TrackingController.java:[31,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/tracking/TrackingController.java:[33,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/trackingmetadatas/TrackingMetadatasController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/trackingmetadatas/TrackingMetadatasController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/time/TimeController.java:[13,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/time/TimeController.java:[19,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/projects/ProjectsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/projects/ProjectsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/heartbeat/HeartbeatController.java:[6,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/heartbeat/HeartbeatController.java:[8,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/login/LoginController.java:[9,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/login/LoginController.java:[11,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/users/UsersController.java:[14,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/users/UsersController.java:[16,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/modreqs/ModReqController.java:[25,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/modreqs/ModReqController.java:[31,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportparts/ReportPartsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportparts/ReportPartsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reports/ReportsController.java:[21,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
/var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reports/ReportsController.java:[23,1] error: cannot find symbol
[INFO] 24 errors
[INFO] -------------------------------------------------------------
Collecting metadata...
Metadata collection done.
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.033s
[INFO] Finished at: Mon Oct 13 16:07:55 CEST 2014
[INFO] Final Memory: 26M/246M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project rtm-backend: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportitems/ReportItemsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportitems/ReportItemsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportmembers/ReportMembersController.java:[10,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportmembers/ReportMembersController.java:[12,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/tracking/TrackingController.java:[31,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/tracking/TrackingController.java:[33,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/trackingmetadatas/TrackingMetadatasController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/trackingmetadatas/TrackingMetadatasController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/time/TimeController.java:[13,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/time/TimeController.java:[19,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/projects/ProjectsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/projects/ProjectsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/heartbeat/HeartbeatController.java:[6,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/heartbeat/HeartbeatController.java:[8,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/login/LoginController.java:[9,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/login/LoginController.java:[11,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/users/UsersController.java:[14,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/users/UsersController.java:[16,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/modreqs/ModReqController.java:[25,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/modreqs/ModReqController.java:[31,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportparts/ReportPartsController.java:[11,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reportparts/ReportPartsController.java:[13,1] error: cannot find symbol
[ERROR] class RestController
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reports/ReportsController.java:[21,46] error: cannot find symbol
[ERROR] package org.springframework.web.bind.annotation
[ERROR] /var/lib/jenkins/workspace/Demo backend - Poll/src/main/java/demo/rtm/backend/reports/ReportsController.java:[23,1] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[JENKINS] Archiving /var/lib/jenkins/workspace/Demo backend - Poll/pom.xml to demo.rtm/rtm-backend/0.1.9/rtm-backend-0.1.9.pom
Sending e-mails to: test@mail.com
channel stopped
Skipping Cobertura coverage report as build was not SUCCESS or better ...
[htmlpublisher] Archiving HTML reports...
Performance: No threshold configured for making the test failure
Performance: No threshold configured for making the test unstable
Collecting metadata...
Metadata collection done.
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demo.rtm</groupId>
<artifactId>rtm-backend</artifactId>
<version>0.1.9</version>
<packaging>war</packaging>
<name>rtm-backend</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<application.logdir>${user.home}/logs/rtm</application.logdir>
<tomcat.deploy>true</tomcat.deploy>
<security.headerKey>RTM_LOGIN_TOKEN</security.headerKey>
<build.time>${maven.build.timestamp}</build.time>
<maven.build.timestamp.format>yyyy.MM.dd. HH:mm</maven.build.timestamp.format>
<application.logdir.base>/home/demo/logs/rtm</application.logdir.base>
</properties>
<dependencies>
<dependency>
<groupId>dmeo</groupId>
<artifactId>demo-common</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kubek2k</groupId>
<artifactId>springockito</artifactId>
<version>1.0.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.10-FINAL</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<database.location>localhost</database.location>
<database.port>3306</database.port>
<database.dbname>rtm</database.dbname>
<tomcat.host>localhost:8080</tomcat.host>
<tomcat.username>tomcat</tomcat.username>
<tomcat.password>tomcat</tomcat.password>
<doDBTests>true</doDBTests>
<war.moduleName>DEVELOPMENT</war.moduleName>
<war.path>rtm-backend</war.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>src/main/resources/devspecific/rtm-settings.${user.name}.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<finalName>${war.path}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>devspecific</exclude>
<exclude>devspecific/**</exclude>
<exclude>db_scripts</exclude>
<exclude>db_scripts/**</exclude>
<exclude>**/*.xls</exclude>
<exclude>**/*.xlsx</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<directory>src/main/webapp/WEB-INF/</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/webapp/META-INF/</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>context.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
<warName>${war.path}</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.9</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<type>remote</type>
</container>
<skip>${!tomcat.deploy}</skip>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.uri>http://${tomcat.host}/manager/text</cargo.remote.uri>
<cargo.remote.username>${tomcat.username}</cargo.remote.username>
<cargo.remote.password>${tomcat.password}</cargo.remote.password>
<context>${war.path}</context>
</properties>
</configuration>
<deployer>
<type>remote</type>
</deployer>
<deployables>
<deployable>
<properties>
<context>${war.path}</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:0)
demo-common包括依赖,我觉得这里有些错误。
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demo</groupId>
<artifactId>demo-common</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>demo-common</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.0.6.RELEASE</spring.version>
<spring.security.version>3.2.4.RELEASE</spring.security.version>
<log4j.version>2.0</log4j.version>
<jackson.version>2.4.2</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</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-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument-tomcat</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</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-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.6.2.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- Log4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- JAX-RS provider -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.8.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</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.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
更新
错误原因:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
答案 1 :(得分:0)
我遇到了同样的问题。我更新了詹金斯。我降低了詹金斯的评级。我改变了maven和jdk版本。就像描述here一样,我玩了依赖版本。对我来说没什么用。 Jenkins构建失败,但在控制台中的同一台机器上构建工作。
我的解决方案是使用jenkins工作类型。当我将工作从自由式改为maven式工作时,构建工作正常。所以我把我的自由式工作分成了一个专业和自由式的工作。对我来说这很好,因为我厌倦了分析问题。
答案 2 :(得分:0)
我也面临同样的问题,就像Maximilian Wollnik一样,我的解决方案是正确设置环境变量:
echo $JAVA_HOME
/usr/java/jdk1.8.0_60/
管理Jenkins&gt;全球属性&gt;环境变量
Name: JAVA_HOME (case sensitive)
Value: /usr/java/jdk1.8.0_60/