Using relative paths when deploying ZIP artifact using Jenkins Artifactory Plugin

1,417 views
Skip to first unread message

abargnesi

unread,
Mar 28, 2012, 1:47:19 PM3/28/12
to Jenkins Users
Hello,

I have a ZIP file generated by a maven assembly that I want to install
into an artifactory instance. This ZIP file is not an artifact of the
maven build so it is not picked up by the Maven3 artifactory
deployment. I instead enabled Generic-Artifactory Integration and
mapped that zip file to a path on artifactory.

The problem is it always appends the relative path of the ZIP file to
the deployment path on artifactory. My goal is to deploy into a
standard maven layout GROUP_ID/ARTIFACT_ID/VERSION. Is this possible
from the jenkins artifactory plugin?

Thanks!
Tony Bargnesi

Jim McCaskey

unread,
Mar 28, 2012, 2:00:46 PM3/28/12
to Jenkins Users
Tony,

Jenkins should pick up things generated by the maven assembly plugin. Having said that, could you not use the build-helper-maven plugins attach-artifact goal to attach the zip file to your Maven project:

http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html

After that Maven and Jenkins would do what comes naturally.

-Jim

abargnesi

unread,
Mar 28, 2012, 3:14:58 PM3/28/12
to Jenkins Users
Jim,

Thanks for the help. My assembly descriptor has some deprecated
elements (moduleSet/binaries) so I'm not sure I can expect Maven to
contribute the built zip to the project.

I have just given the build-helper-maven-plugin attach-artifact a go
and it fails with the following message:

[ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-
plugin:1.7:attach-artifact (default-cli) on project
BELFrameworkMaster: The parameters 'artifacts' for goal
org.codehaus.mojo:build-helper-maven-plugin:1.7:attach-artifact are
missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.codehaus.mojo:build-helper-maven-plugin:1.7:attach-
artifact (default-cli) on project BELFrameworkMaster: The parameters
'artifacts' for goal org.codehaus.mojo:build-helper-maven-plugin:
1.7:attach-artifact are missing or invalid
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
221)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:
84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:
59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:
183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:
161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:
290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:
230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:
409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.PluginParameterException: The
parameters 'artifacts' for goal org.codehaus.mojo:build-helper-maven-
plugin:1.7:attach-artifact are missing or invalid
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:
576)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:
529)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:
92)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
209)
... 19 more

The plugin was defined and called after my "assembly:assembly" goal:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/project-${release.version}.zip</file>
<type>zip</type>
</artifact>
</artifacts>
<runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
</configuration>
</execution>
</executions>
</plugin>

I don't see an issue with my artifact configuration given that the
relative
file patch should be accessible from the execution root.

Any ideas here?

Thanks!
Tony Bargnesi

On Mar 28, 2:00 pm, Jim McCaskey <jim.mccas...@pervasive.com> wrote:
> Tony,
>
> Jenkins should pick up things generated by the maven assembly plugin.  Having said that, could you not use the build-helper-maven plugins attach-artifact goal to attach the zip file to your Maven project:
>
> http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mo...

Jim McCaskey

unread,
Mar 28, 2012, 3:29:45 PM3/28/12
to Jenkins Users
Tony,

I believe that you will need to add a classifier. I think a phase will be needed as well. There is an example of attaching an artifact here (you have to scroll a bit, that page does not have direct links):

http://mojo.codehaus.org/build-helper-maven-plugin/usage.html

I think using the contents of what you sent along, looking at the above page, and looking at one of my own pom's that I know works, that would translate to something like this:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>

<phase>package</phase>


<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>

<file>${project.build.directory}/project-${release.version}.zip</file>
<type>zip</type>
<classifier>myfile</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>

You would change "myfile" to whatever you want.

abargnesi

unread,
Mar 28, 2012, 5:03:16 PM3/28/12
to Jenkins Users
Jim,

Thanks. That worked for me. I added the ${project.build.directory}
property into <file> and then made up a <classifier>. I still was not
able to deploy using the artifactory plugin so I instead added a post-
build maven step to run deploy:deploy-file. Solid for now!

Thanks for the help!
Tony

On Mar 28, 3:29 pm, Jim McCaskey <jim.mccas...@pervasive.com> wrote:
> Tony,
>
Reply all
Reply to author
Forward
0 new messages