Jenkins build not uploading artifacts to Nexus

karlapudiravi
Participant III

Hi,

I am doing build and deployment through Jenkins job, but the proxy .zip file is not getting uploaded to nexus (i see .pom file is getting uploaded to Nexus). Please help me in resolving this. Can anyone please share any document specifying the Jenkins job configurations.

Regards,

Ravi.

0 11 3,468
11 REPLIES 11

Hi - is this Jenkins problem related to Apigee at all ?

if so, can you explain how? More details please?

It sounds like There is an apigee proxy involved in the job, but the apigee system itself is not involved in this step. It's just Jenkins and nexus, is that right?

Hi @Dino,

It has nothing to do with Apigee, it is related to Jenkins and nexus. I wanted to check if any one in the community has done the jenkins configurations, so that i can get some help in doing so.

Not applicable

Any solution to this? I got similar problem. It seems that the pom file is the only file recognized as a build output of the maven command.

rmishra
Participant V

@ravi kumar karlapudi @Ron Teo

1. Is there a zip artifact created in your local workspace (It should be, if you've configured and executed the apigee plugins correctly). If it does not exist, fix that first. Because if the zip file does not exist , there is nothing to push to the repository.

2. I am assuming you are running the mvn deploy command to push to Nexus. Try running the mvn deploy:deploy-file goal instead

http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html

Please post an update if it works out

Not applicable

@rmishra

Thanks for the answer. The zip file exist but it doesnt upload via the typical deploy.

As per you mentioned, I tried doing a deploy:deploy-file and it works. But I have to specify the details which can be a little bit more troublesome.

By any chance do you also have any experience of using jenkins to download the zip bundle? I couldn't get maven artifact resolver / dependency get to ignore the pom file.

Instead of specifying everything at the command line, you can explicitly configure the maven deploy plugin (deploy-file) goal in your pom xml, and then rely on conventions in it's configuration section.

I do use the maven dependency plugin to download and resolve the artifacts, what is the issue with pom file being around? You should be able to ignore the pom file while assembling the zip - that is a more conventional thing to do.

I see. I will try to include that in the pom xml!

For the maven dependency, the plugin seems to always look into the pom file, then try to resolve the parent pom (which doesnt exist). I tried to search online but couldn't find any information how to ignore the pom file when I am just trying to resolve the zip. Can you share with me the goals / parameter you are using?

Thanks for the great help. I really appreciate it!

You could run the mvn dependency plugin using dependency:get as follows

https://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html

You can specify the artifact coordinates with

-Dartifact=groupId:artifactId:version

Maven will look into your settings.xml (to determine which repository to use) and download the artifact

Glad to be of help.

I tried using something like this -

sh 'mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.0:get ' +

'-Dartifact=com.ron.teo.apigee:template-api:LATEST:zip: ' +

'-DremoteRepositories=maven-snapshots ' +

'-Dtransitive=false'

But i still get the error that it seems to be looking for the parent pom.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.0:get (default-cli) on project standalone-pom: Couldn't download artifact: Failed to read artifact descriptor for com.ron.teo.apigee:template-api:zip:LATEST: Could not transfer artifact com.ron.teo.apigee:parent-pom:pom:1.0 from/to temp (maven-snapshots): No connector available to access repository temp (maven-snapshots) of type default using the available factories WagonRepositoryConnectorFactory -> [Help 1]

Thanks again for your help!

What URL does maven-snapshots resolve to?

Try removing that flag and the transitive flag

What is this artifact >> com.ron.teo.apigee:parent-pom:pom:1.0?

Is this referenced from your pom?

The URL resolve to my internal nexus maven-snapshots. I can download the maven-metadata fine.

I think the dependency:get command is trying to read into my api proxy pom file (which was deployed together with the zip file), and try to reference back to the parent pom at the /gateway folder. But it doesn't exist (not uploaded)

I figured that I need to either,

1) Avoid deploying the pom file during deploy stage (Not sure how this can be done but I thought this is required for maven type repository)

2) Avoid referencing to the pom file during dependency get (not sure how this can be done also)

Do you have any idea?

Thanks!

[Update] I generate a pom file with deploy-file and upload that instead of the original pom. The updated pom look like this -

<modelVersion>4.0.0</modelVersion> <groupId>com.ron.teo.apigee</groupId> <artifactId>template-api</artifactId> <version>1.0-SNAPSHOT</version> <packaging>zip</packaging> </project>

However, I am still facing problem with my dependency trying to reference to parent-pom. I have no idea why this is happening as there are no reference to parent-pom anywhere in my nexus repo. Not even in my project.