Maven 2 build doesn't work from TeamCity
Hi,
I'm trying to execute a maven 2 script from my TeamCity project but it doesn't work.
The command i use is mvn package sonar:sonar. This command works fine from the command line, but when the build is launched from TeamCity, i've an error resolving the dependencies.
Here are the complete build log :
[13:41:33]: Checking for changes
[13:41:34]: Clearing temporary directory: C:\Program Files (x86)\TeamCity\agents\agent2\temp\buildTmp
[13:41:34]: Checkout directory: M:\Server\Build\src\utils\JTheque Core
[13:41:34]: Updating sources
[13:41:34]: [Updating sources] Building incremental patch for VCS root: JTheque Core Repository
[13:41:34]: [Updating sources] Repository sources transferred
[13:41:35]: MAVEN_OPTS = -Dteamcity.agent.dotnet.build_id=228 "-Dteamcity.buildConfName=JTheque Core" "-Dagent.home.dir=C:\Program Files (x86)\TeamCity\agents\agent2" -DDotNetFramework3.0= -Dbuild.number=44 "-Dteamcity.dotnet.nunitlauncher2.0=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe" -DDotNetFramework3.5_x64_Path=C:\Windows\Microsoft.NET\Framework64\v3.5 -Duser.language=fr -Dos.version=6.0 -Dfile.encoding=Cp1252 -DDotNetFramework3.0_x86= -Dteamcity.projectName=JTheque "-Dteamcity.dotnet.nunitlauncher2.0.vsts=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe" -DDotNetFramework2.0_x86_Path=C:\Windows\Microsoft.NET\Framework\v2.0.50727 -DDotNetFramework2.0_Path=C:\Windows\Microsoft.NET\Framework64\v2.0.50727 -DDotNetFramework2.0_x64= "-Dteamcity.dotnet.coveragelauncher=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\TeamCityRunners\JetBrains.dotTrace.TeamCity.CoverageRunner.exe" "-Dteamcity.dotnet.nunitlauncher=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" "-Djava.io.tmpdir=C:\Program Files (x86)\TeamCity\agents\agent2\temp\buildTmp" -Duser.name=SYSTEM -DDotNetFramework3.5_Path=C:\Windows\Microsoft.NET\Framework64\v3.5 "-Dteamcity.version=4.5.4 (build 9071)" -DDotNetFramework3.0_Path=C:\Windows\Microsoft.NET\Framework\v3.0 -Dteamcity.auth.password=teWZw48MXPwhic3bt7scSWHPlIoJXXYD "-Dteamcity.build.checkoutDir=M:\Server\Build\src\utils\JTheque Core" -Dteamcity.buildType.id=bt11 -DDotNetFramework3.5= -Duser.variant= "-Dteamcity.dotnet.nunitlauncher1.1=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe" "-Dteamcity.dotnet.nunitlauncher.msbuild.task=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll" -DDotNetFramework3.5_x86_Path=C:\Windows\Microsoft.NET\Framework\v3.5 -Didea.build.server.build.id=228 -Dpath.separator=; "-Dteamcity.build.workingDir=M:\Server\Build\src\utils\JTheque Core" "-Dteamcity.build.properties.file=C:\Program Files (x86)\TeamCity\agents\agent2\temp\agentTmp\teamcity.build6638.properties" -Dagent.name=Build-Agent-2 "-Dteamcity.dotnet.platform=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe" -Dbuild.number.format={0} -Duser.country=CH -Duser.timezone=Europe/Berlin -DDotNetFramework2.0_x86= -Dfile.separator=\ "-Dagent.work.dir=C:\Program Files (x86)\TeamCity\agents\agent2\work" -Dos.arch=x86 -DDotNetFramework3.0_x86_Path=C:\Windows\Microsoft.NET\Framework\v3.0 -DDotNetFramework2.0= -Dbuild.vcs.number=516 "-Dteamcity.build.tempDir=C:\Program Files (x86)\TeamCity\agents\agent2\temp\buildTmp" -Dbuild.vcs.number.1=516 "-Dos.name=Windows Vista" "-Dteamcity.dotnet.nunitaddin=C:\Program Files (x86)\TeamCity\agents\agent2\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit" -Didea.build.agent.port=9091 -DDotNetFramework3.5_x86= -Dteamcity.auth.userId=TeamCityBuildId=228 -DDotNetFramework3.5_x64= -Dteamcity.agent.dotnet.agent_url=http://localhost:9091/RPC2 -Dagent.flow=15397593015872 -DDotNetFramework2.0_x64_Path=C:\Windows\Microsoft.NET\Framework64\v2.0.50727 -Dteamcity.agent.cpuBenchmark=253 -Dbuild.vcs.number.JTheque_Core_Repository=516 -Duser.home=C:\Windows\System32\config\systemprofile
[13:41:35]: M2_HOME = C:\Program Files (x86)\Apache Software Foundation\Maven
[13:41:35]: PATH = C:\Program Files (x86)\Apache Software Foundation\Maven\bin;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\MiKTeX 2.7\miktex\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Java\jdk1.6.0_10\jre\bin;C:\Perl\bin;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files (x86)\Apache Software Foundation\Maven\bin;C:\Program Files (x86)\Java\jdk1.6.0_06/bin;C:\Program Files\TortoiseSVN\bin;C:\Python25;C:\Program Files (x86)\Java\jdk1.6.0_06\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\DivX Shared\;C:\Program Files (x86)\QuickTime\QTSystem\
[13:41:35]: JAVA_HOME = C:\Program Files (x86)\Java\jdk1.6.0_06
[13:41:35]: M:\Server\Build\src\utils\JTheque Core>set MAVEN_OPTS=-Xmx512m -Xms64m -XX:MaxPermSize=256m
[13:41:35]: [INFO] Scanning for projects...
[13:41:36]: [INFO] Searching repository for plugin with prefix: 'sonar'.
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [INFO] Building JTheque Core
[13:41:36]: [INFO] task-segment: [package]
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [INFO] [resources:resources {execution: default-resources}]
[13:41:36]: [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[13:41:36]: [INFO] skip non existing resourceDirectory M:\Server\Build\src\utils\JTheque Core\src\main\resources
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [ERROR] BUILD ERROR
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [INFO] Failed to resolve artifact.
[13:41:36]: Missing:
[13:41:36]: ----------
[13:41:36]: 1) org.jtheque:jtheque-utils:jar:1.1.1-SNAPSHOT
[13:41:36]: Try downloading the file manually from the project website.
[13:41:36]: Then, install it using the command:
[13:41:36]: mvn install:install-file -DgroupId=org.jtheque -DartifactId=jtheque-utils -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
[13:41:36]: Alternatively, if you host your own repository you can deploy the file there:
[13:41:36]: mvn deploy:deploy-file -DgroupId=org.jtheque -DartifactId=jtheque-utils -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[13:41:36]: Path to dependency:
[13:41:36]: 1) org.jtheque:jtheque-core:jar:2.0
[13:41:36]: 2) org.jtheque:jtheque-utils:jar:1.1.1-SNAPSHOT
[13:41:36]: ----------
[13:41:36]: 1 required artifact is missing.
[13:41:36]: for artifact:
[13:41:36]: org.jtheque:jtheque-core:jar:2.0
[13:41:36]: from the specified remote repositories:
[13:41:36]: central (http://repo1.maven.org/maven2)
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [INFO] For more information, run Maven with the -e switch
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: [INFO] Total time: 1 second
[13:41:36]: [INFO] Finished at: Tue Aug 18 13:41:36 CEST 2009
[13:41:36]: [INFO] Final Memory: 14M/63M
[13:41:36]: [INFO] ------------------------------------------------------------------------
[13:41:36]: Number of processed tests: 0
[13:41:36]: Build finished
And here are the configuration of the Maven 2 runner :
Type of runner: Maven2 (Runner for Maven build file)POM file path (relative to the build working directory): pom.xml
Goals: package sonar:sonar
Maven home path: C:\Program Files (x86)\Apache Software Foundation\Maven
Additional Maven command line parameters: none specified
User settings path: not specified
JDK home path: not specified
JVM command line parameters: not specifiedXML report processing: disabled
Has someone an idea of what is changing between the command line and teamcity ?
Thank you
Baptiste Wicht
Please sign in to leave a comment.
Hello,
You were probably running both builds under different users.
Try running it again with debug output (-X) both manually and from TeamCity and send me the logs.
Thank you
Great, that's it
The user was not the same, so the repository was not the good repository. I've forced the repository in the settings.xml and all works fine.
Thank you very much.