Build step cannot download metadata.xml (Not authorized , ReasonPhrase:.)
Server setup:
I have setup a Dockerized Teamcity server and Teamcity agent on two containers. They can communicate with each other as are on the same network.
Teamcity Build Setup:
I have a Maven project that has a build step that generates an artifact. The idea is to have this artifact available to other projects in Teamcity.
So I created a second Maven project, and added teamcity as one of the repositories to fetch this dependency. I configured the pom file as follows:
...
<repositories>
<repository>
<id>teamcity</id>
<name>TeamCity Build System</name>
<url>http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful</url>
</repository>
...
The problem is that building this second project (mySecondProject) is generating the following error:
[16:10:25][Step 2/3] Downloading: http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful/myFirstProject/mySharedLibrary/1.0.0-SNAPSHOT/maven-metadata.xml
[16:10:26][Step 2/3] [WARNING] Could not transfer metadata myFirstProject:mySharedLibrary:1.0.0-SNAPSHOT/maven-metadata.xml from/to teamcity (http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful): Not authorized , ReasonPhrase:.
[16:10:26][Step 2/3] [WARNING] Failure to transfer myFirstProject:mySharedLibrary:1.0.0-SNAPSHOT/maven-metadata.xml from http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful was cached in the local repository, resolution will not be reattempted until the update interval of teamcity has elapsed or updates are forced. Original error: Could not transfer metadata myFirstProject:mySharedLibrary:1.0.0-SNAPSHOT/maven-metadata.xml from/to teamcity (http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful): Not authorized , ReasonPhrase:.
[16:10:26][Step 2/3] Downloading: http://teamcity:8111/repository/download/myBuild/latest.lastSuccessful/myFirstProject/mySharedLibrary/1.0.0-SNAPSHOT/mySharedLibrary-1.0.0-SNAPSHOT.pom
[16:10:31][Step 2/3] Failed to execute goal on project mySecondProject: Could not resolve dependencies for project myFirstProject:mySecondProject:jar:1.0.0-SNAPSHOT: Failed to collect dependencies for [org.scala-lang:scala-library:jar:2.10.5 (provided), org.scalactic:scalactic_2.10:jar:3.0.1 (compile), org.scalatest:scalatest_2.10:jar:3.0.1 (test), myFirstProject:mySharedLibrary:jar:1.0.0-SNAPSHOT (compile), org.apache.spark:spark-core_2.10:jar:1.6.2 (provided), com.holdenkarau:spark-testing-base_2.10:jar:1.6.1_0.6.0 (test), org.apache.kafka:kafka-clients:jar:0.10.2.0 (compile), io.spray:spray-json_2.10:jar:1.3.3 (compile), org.apache.logging.log4j:log4j-core:jar:2.9.1 (compile), org.apache.logging.log4j:log4j-api:jar:2.9.1 (compile)]
The error is "Not authorized, ReasonPhrase:." - Googling around did not help me much.
Please sign in to leave a comment.
Trying to download artifacts from TeamCity requires authentication, and maven isn't using it.
There are several options here, which might be combined:
-Configure the repository to use authentication information: https://confluence.jetbrains.com/display/TCD10/Artifact+Dependencies#ArtifactDependencies-Build-levelauthentication
-Allow for guest access, grant permissions to guest for those artifacts, then access via guest: (https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-RESTAuthentication)
-Use artifact dependencies instead of maven. This might require having a different set of build scripts for teamcity and development environment, but wouldn't require dealing with authentication: https://confluence.jetbrains.com/display/TCD10/Artifact+Dependencies