Quantcast

problems with the maven-deploy-plugin

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

problems with the maven-deploy-plugin

Chris Berry
Greetings,
I  am generating several artifacts from my build; a WAR, a TAR.GZ, and  
a JAR -- as required by downstream usage scenarios (embedded,  
standalone, or webapp)
The project has WAR packaging. But I need to supply a JAR and TAR.GZ  
as well. The TAR.GZ is easy -- using the assembly plugin.
And it is easy to create the JAR (using the <archiveClasses> in the  
maven-war-plugin.
But deploying the JAR is problematic. You have to use both the maven-
install-plugin (the install-file goal). And the maven-deploy-plugin  
(the deploy-file goal).
I have all this working (my POM snippet is below). But my deploy-file  
solution is less than satisfactory. deploy-file requires the <url>  
parameter, and I do not see how to generically supply this value.
More specifically, we have a deploy url for SNAPSHOTs and for  
Releases. And deploy-file only lets us supply one of these. I.e.

                             <url>$
{project.distributionManagement.snapshotRepository.url}</url>

I do not understand why the deploy-file goal cannot just use the  
<distributionManagement> the way that the deploy goal does??
Can someone show me how to wire this up correctly??
As it is we would have to edit the POM when we create a Release, and  
then edit it back -- which is just not right.

Thanks,
-- Chris

The complete POM snippet:

            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-deploy-plugin</artifactId>
                 <inherited>true</inherited>
                 <configuration>
                     <!-- do not create unique binaries for each  
snapshot -->
                     <uniqueVersion>false</uniqueVersion>
                 </configuration>
                 <executions>
                     <execution>
                         <phase>deploy</phase>
                         <goals>
                             <goal>deploy-file</goal>
                         </goals>
                         <configuration>
                             <packaging>jar</packaging>
                             <!-- the Jar is generated by the War, and  
so is down in the target webapp -->
                             <file>
                                 ${project.build.directory}/$
{project.artifactId}-${project.version}/WEB-INF/lib/$
{project.artifactId}-${project.version}.jar
                             </file>
                             <repositoryId>codehaus.org</repositoryId>

                             <!-- TODO :: this should not have to be  
specific -->
                             <url>$
{project.distributionManagement.snapshotRepository.url}</url>

                             <pomFile>
                                ${basedir}/pom.xml
                             </pomFile>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>





S'all good  ---   chriswberry at gmail dot com



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problems with the maven-deploy-plugin

Wendy Smoak
On Thu, Jul 3, 2008 at 3:40 PM, Chris Berry <[hidden email]> wrote:

> I  am generating several artifacts from my build; a WAR, a TAR.GZ, and a JAR
> -- as required by downstream usage scenarios (embedded, standalone, or
> webapp)
> The project has WAR packaging. But I need to supply a JAR and TAR.GZ as
> well.

It sounds like you are trying to do all this from a single module?
The general rule with Maven is 'one main artifact per pom.'

In this situation you'd have a multi-module project with one module
building a jar, another building the war, and a third building the
assembly, plus a parent pom to tie it all together.

With that setup, 'mvn install' and 'mvn deploy' will do what you want.

(That said, there is a new feature of the war plugin that will create
an attached artifact containing the classes [1].  And assemblies can
be combined with other modules, but I prefer to keep it all separate.)

[1] http://jira.codehaus.org/browse/MWAR-131

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problems with the maven-deploy-plugin

Chris Berry
Hi Wendy,
With all due respect, having to build 3 separate projects, all within  
a multi-project  -- so 4 projects where there was once 1 -- certainly  
doesn't seem to be in line w/ "keeping it simple".  Especially when  
all we want is some different packaging for the same raw classes/
resources. So I'll avoid that path if at all possible. I have always  
found maven multi-projects somewhat problematic -- particularly when  
generating sites, reports, etc.

Thanks for the pointer to the WAR plugin. Much appreciated.  I'll take  
a look.

Still what I find confusing is that the deploy plugin is aware of  
SNAPSHOTs versus Releases -- and it chooses the URL dynamically from  
distributionManagement -- so it seems that deploy-file could too??
Thanks,
-- Chris

On Jul 3, 2008, at 5:53 PM, Wendy Smoak wrote:

> On Thu, Jul 3, 2008 at 3:40 PM, Chris Berry <[hidden email]>  
> wrote:
>
>> I  am generating several artifacts from my build; a WAR, a TAR.GZ,  
>> and a JAR
>> -- as required by downstream usage scenarios (embedded, standalone,  
>> or
>> webapp)
>> The project has WAR packaging. But I need to supply a JAR and  
>> TAR.GZ as
>> well.
>
> It sounds like you are trying to do all this from a single module?
> The general rule with Maven is 'one main artifact per pom.'
>
> In this situation you'd have a multi-module project with one module
> building a jar, another building the war, and a third building the
> assembly, plus a parent pom to tie it all together.
>
> With that setup, 'mvn install' and 'mvn deploy' will do what you want.
>
> (That said, there is a new feature of the war plugin that will create
> an attached artifact containing the classes [1].  And assemblies can
> be combined with other modules, but I prefer to keep it all separate.)
>
> [1] http://jira.codehaus.org/browse/MWAR-131
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

S'all good  ---   chriswberry at gmail dot com




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problems with the maven-deploy-plugin

Wendy Smoak
On Thu, Jul 3, 2008 at 4:07 PM, Chris Berry <[hidden email]> wrote:

> Still what I find confusing is that the deploy plugin is aware of SNAPSHOTs
> versus Releases -- and it chooses the URL dynamically from
> distributionManagement -- so it seems that deploy-file could too??

I've never seen deploy-file used within a pom, it's generally used at
the command line to deploy artifacts that were not built with Maven,
and you supply the url.  It doesn't seem unreasonable, though... you
can open an enhancement issue in JIRA if you like.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problems with the maven-deploy-plugin

Chris Berry
Thanks Wendy.
I was going to try out the <attachClasses>true</attachClasses> for the  
maven-war-plugin, but I don't know where to get it from??
Do I need to build it myself from the SVN trunk??
So to be clear, if I use <attachClasses>, will this cause a JAR to be  
automatically installed in my local repo (for mvn install) and  
automatically deployed (for mvn deploy)
If so, that's exactly what I'm looking for.
Thanks much,
-- Chris

On Jul 3, 2008, at 6:24 PM, Wendy Smoak wrote:

> On Thu, Jul 3, 2008 at 4:07 PM, Chris Berry <[hidden email]>  
> wrote:
>
>> Still what I find confusing is that the deploy plugin is aware of  
>> SNAPSHOTs
>> versus Releases -- and it chooses the URL dynamically from
>> distributionManagement -- so it seems that deploy-file could too??
>
> I've never seen deploy-file used within a pom, it's generally used at
> the command line to deploy artifacts that were not built with Maven,
> and you supply the url.  It doesn't seem unreasonable, though... you
> can open an enhancement issue in JIRA if you like.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

S'all good  ---   chriswberry at gmail dot com




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problems with the maven-deploy-plugin

Wendy Smoak
On Thu, Jul 3, 2008 at 4:34 PM, Chris Berry <[hidden email]> wrote:

> I was going to try out the <attachClasses>true</attachClasses> for the
> maven-war-plugin, but I don't know where to get it from??
> Do I need to build it myself from the SVN trunk??

Building it yourself is an option, but if you're not already doing
that it's usually easier to grab the latest snapshot from the repo.
See:
http://maven.apache.org/guides/development/guide-testing-development-plugins.html

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...