Why isn't Jenkins uploading my last snapshot?

I have work on creating Jenkins for the maven 3 project. The project has a SNAPSHOT dependency. Build failed because Maven cannot find the SNAPSHOT artifact that is deployed to the Sonatype Nexus repository registry on the intranet. The SNAPSHOT repository is part of the โ€œpublicโ€ group, which is the mirror URL for <mirrorOf>*</mirrorOf> .
Jenkins is set up to create a local Maven repository local to the workspace (one job for one job).
All other dependencies other than the snapshot are resolved and uploaded. Other jobs for projects without SNAPSHOT dependencies have also been successfully created. Things I've tried so far (without success):

  • Expired Nexus Cache
  • Local storage checked (in the job directory) - there was no artifact directory
  • Set "Build -> Goals and options" to "-U clean install" in the job configuration
  • Wait one hour.

My setup:
Windows Server 2003
Java 1.6.0_31
Jenkins 1.480
Maven 3.0.3

+4
source share
2 answers

It could be a โ€œgotcha,โ€ which I also discovered while downloading snapshot changes from Nexus.

The solution is provided in the Nexus book , but is not fully explained:

 <settings> <mirrors> <mirror> <id>nexus</id> <url>http://myserver/nexus/content/groups/public</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles> </settings> 

It seems you need to explicitly tell Maven that the repository group provided by Nexus may also contain snapshot changes. Presumably what this means is to run Maven to start looking for special metadata files that are used to detect which temporary file is actually the last snapshot.

+3
source

Since you already defined mirrorOf/* , just add this to your .m2/settings.xml to tell maven to search for this mirror also for the snapshot:

 <profile><id>alwaysactive</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository><id>unused</id><url>unused</url></repository> </repositories> </profile> 
+1
source

Source: https://habr.com/ru/post/1432743/


All Articles