Maven build runner error when dependencies are set differently

Answered

We had a code triggered error that caused TeamCity to fail with: 

Cannot start build runner: Failed to start build runner 'Maven2'

This took a while to track down and I wonder why this fails in TeamCity but not at a command line. The solution was to move the list of dependencies that get the version from dependenciesMangement to the dependencies section in the pom.xml file.

The previous change to the pom.xml file caused TeamCity to fail with the above error but running a maven command with the same code from the command line passed. Why would TeamCity fail in this case?

Thanks,

-Dave

 

0
4 comments

Hello Dave,

These problems looks like different Maven versions used in local builds and server builds. Please, check that same maven version is used to build projects locally and on build server

0
Avatar
Permanently deleted user

Hi Nikita,

In all cases, both on build agents and the build server, Maven 3.2.5 is locally deployed and in the build user's path.

The TeamCity server and one agent: 

[dave.leskovac@alab-tcs01] ~ $ sudo su - teamcity

[sudo] password for dave.leskovac:

[teamcity@alab-tcs01 ~]$ mvn -version

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)

Maven home: /usr/local/maven

Java version: 1.7.0_80, vendor: Oracle Corporation

Java home: /usr/java/jdk1.7.0_80/jre

 

[teamcity@alab-tca10 ~]$ mvn -version

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)

Maven home: /usr/local/maven

Java version: 1.7.0_80, vendor: Oracle Corporation

Java home: /usr/java/jdk1.7.0_80/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-279.el6.x86_64", arch: "amd64", family: "unix"

 

My laptop:

[dleskovac@mac] ~$ mvn -version

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)

Maven home: /opt/local/share/java/maven32

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "mac os x", version: "10.12.2", arch: "x86_64", family: "mac"

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-279.el6.x86_64", arch: "amd64", family: "unix"

-Dave

0

TeamCity's Maven2 runner also tries to evaluate project's model before build (to get some infomation, including project version) and uses bundled Maven 3.0.5 to do it (unless maven 2.2.1 is set explicitly). Can you try evaluating the project using maven 3.0.5?

0
Avatar
Permanently deleted user

Thanks for the explanation, Nikita. As I wrote in the original post, the pom file was changed to fix the problem. I just wondered how there could be a difference in how maven worked on a command line and through TeamCity.

0

Please sign in to leave a comment.