Quantcast

Deploy Multiple Jars to Release

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

Deploy Multiple Jars to Release

entdeveloper
I have a maven project that's currently generating two artifacts to be deployed: my-library.jar and my-library-jar-with-dependencies.jar. The assembly plugin is used to generate the jar-with-dependencies, which is used to run the library as a batch job from the command line. I also want to just have the library deployed as a stand-alone jar which can be used by other projects.

When running 'mvn deploy' to nexus as a release, I'm able to upload both jars to the repo under the same GAV, however, nexus is returning a 400 response.

I'm assuming this is because my Deployment Policy for my releases repo is set to 'Disable Redeploy', which is correct. However, why isn't it able to correctly sense that these are two different forms of the same library? Is there something in my setup that I need to fix?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Manfred Moser-4
On 11-12-28 03:59 PM, entdeveloper wrote:

> I have a maven project that's currently generating two artifacts to be
> deployed: my-library.jar and my-library-jar-with-dependencies.jar. The
> assembly plugin is used to generate the jar-with-dependencies, which is used
> to run the library as a batch job from the command line. I also want to just
> have the library deployed as a stand-alone jar which can be used by other
> projects.
>
> When running 'mvn deploy' to nexus as a release, I'm able to upload both
> jars to the repo under the same GAV, however, nexus is returning a 400
> response.
>
> I'm assuming this is because my Deployment Policy for my releases repo is
> set to 'Disable Redeploy', which is correct. However, why isn't it able to
> correctly sense that these are two different forms of the same library? Is
> there something in my setup that I need to fix?
>

How are you doing the deploy of both artifacts? In my experience it
works to have the Maven build helper artifact attach additional
artifacts with a different type. Then it will all deploy it in one sweep
and work..

manfred

--
Manfred Moser
http://simpligility.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: Deploy Multiple Jars to Release

entdeveloper
Manfred Moser-4 wrote
How are you doing the deploy of both artifacts? In my experience it
works to have the Maven build helper artifact attach additional
artifacts with a different type. Then it will all deploy it in one sweep
and work..
I'm simply running 'mvn deploy'

In my pom, I have the assembly plugin configured like so:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>make-assembly</id>
            <goals>
              <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
              <archive>
                <manifest>
                  <mainClass>Runner</mainClass>
                </manifest>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>

So by the time the 'deploy' is run, there are two jars waiting to be deployed to Nexus. Now, according to the assembly plugin's description (http://maven.apache.org/plugins/maven-assembly-plugin/usage.html):

"When the assembly is created it will use the assemblyId as the artifact's classifier and will attach the created assembly to the project so that it will be uploaded into the repository on the install and deploy goals."

So I expect maven/nexus to honor the attached jar file and upload accordingly without the need for the build helper plugin. But it seems Nexus is rejecting the upload of the attached jar because it thinks it's already there?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Manfred Moser-4
On 11-12-28 04:37 PM, entdeveloper wrote:

> Manfred Moser-4 wrote
>>
>> How are you doing the deploy of both artifacts? In my experience it
>> works to have the Maven build helper artifact attach additional
>> artifacts with a different type. Then it will all deploy it in one sweep
>> and work..
>>
>>
> I'm simply running 'mvn deploy'
>
> In my pom, I have the assembly plugin configured like so:
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-assembly-plugin</artifactId>
>          <executions>
>            <execution>
>              <id>make-assembly</id>
>              <goals>
>                <goal>single</goal>
>              </goals>
>              <phase>package</phase>
>              <configuration>
>                <descriptorRefs>
>                  <descriptorRef>jar-with-dependencies</descriptorRef>
>                </descriptorRefs>
>                <archive>
>                  <manifest>
>                    <mainClass>Runner</mainClass>
>                  </manifest>
>                </archive>
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
>
> So by the time the 'deploy' is run, there are two jars waiting to be
> deployed to Nexus. Now, according to the assembly plugin's description
> (http://maven.apache.org/plugins/maven-assembly-plugin/usage.html):
>
> /"When the assembly is created it will use the assemblyId as the artifact's
> classifier and will attach the created assembly to the project so that it
> will be uploaded into the repository on the install and deploy goals."/
>
> So I expect maven/nexus to honor the attached jar file and upload
> accordingly without the need for the build helper plugin. But it seems Nexus
> is rejecting the upload of the attached jar because it thinks it's already
> there?
>
Does you assembly have any difference in the GAV coordinates? If not..
Nexus is right to refuse. You need to make sure the coordinates are
different .. minimum a different classifier.

manfred

---------------------------------------------------------------------
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: Deploy Multiple Jars to Release

entdeveloper
Manfred Moser-4 wrote
Does you assembly have any difference in the GAV coordinates? If not..
Nexus is right to refuse. You need to make sure the coordinates are
different .. minimum a different classifier.
Same GAV coordinates. Doesn't the assembly plugin automatically set the classifier to 'jar-with-dependencies'? (http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Manfred Moser-4
On 11-12-28 04:53 PM, entdeveloper wrote:

> Manfred Moser-4 wrote
>>
>> Does you assembly have any difference in the GAV coordinates? If not..
>> Nexus is right to refuse. You need to make sure the coordinates are
>> different .. minimum a different classifier.
>>
>>
> Same GAV coordinates. Doesn't the assembly plugin automatically set the
> classifier to 'jar-with-dependencies'?
> (http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html).

It should I guess.. check what gets into your local repo when you do a
mvn install


manfred



--
Manfred Moser
http://simpligility.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: Deploy Multiple Jars to Release

Benson Margulies
On Wed, Dec 28, 2011 at 7:58 PM, Manfred Moser <[hidden email]> wrote:

> On 11-12-28 04:53 PM, entdeveloper wrote:
>>
>> Manfred Moser-4 wrote
>>>
>>>
>>> Does you assembly have any difference in the GAV coordinates? If not..
>>> Nexus is right to refuse. You need to make sure the coordinates are
>>> different .. minimum a different classifier.
>>>
>>>
>> Same GAV coordinates. Doesn't the assembly plugin automatically set the
>> classifier to 'jar-with-dependencies'?

No. It sets it to the value of the 'id' element of the descriptor.
Run mvn -X and see what it has to say.


>>
>> (http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html).
>
>
> It should I guess.. check what gets into your local repo when you do a
> mvn install
>
>
>
> manfred
>
>
>
> --
> Manfred Moser
> http://simpligility.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
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: Deploy Multiple Jars to Release

entdeveloper
In reply to this post by Manfred Moser-4
Manfred Moser-4 wrote
It should I guess.. check what gets into your local repo when you do a
mvn install
'mvn install' worked no problem, both jar files are in the repo and the build was successful.

I also tried switching Deployment Policy settings in Nexus to 'Allow Redeploy', and that worked, as expected, but obviously as this is a releases repo, I don't want to have that enabled. It works when deploying to my snapshots repo.

Since I'm simply trying to deploy an artifact with an attached artifact, and the attachment has a different classifier, to me, it doesn't seem like this should qualify as a redeploy, and I expected Nexus to be aware of that. Another setting in my pom I'm missing here?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Benson Margulies
On Wed, Dec 28, 2011 at 8:18 PM, entdeveloper
<[hidden email]> wrote:

>
> Manfred Moser-4 wrote
>>
>>
>> It should I guess.. check what gets into your local repo when you do a
>> mvn install
>>
>>
>
> 'mvn install' worked no problem, both jar files are in the repo and the
> build was successful.
>
> I also tried switching Deployment Policy settings in Nexus to 'Allow
> Redeploy', and that worked, as expected, but obviously as this is a releases
> repo, I don't want to have that enabled. It works when deploying to my
> snapshots repo.
>
> Since I'm simply trying to deploy an artifact with an attached artifact, and
> the attachment has a different classifier, to me, it doesn't seem like this
> should qualify as a redeploy, and I expected Nexus to be aware of that.
> Another setting in my pom I'm missing here?
>

I do this constantly with no particular magic. I suggest a close
examination of the nexus logs to see exactly what GAVCT is being
complained about.


> --
> View this message in context: http://maven.40175.n5.nabble.com/Deploy-Multiple-Jars-to-Release-tp5106386p5106509.html
> Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
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: Deploy Multiple Jars to Release

entdeveloper
So I upgraded from maven 2.2.1 to maven 3.0.3, and now it seems to deploy correctly. My deploys are controlled from Hudson/Jenkins, so I'll need to figure out if I can do the upgrade there as well, assuming that is the actual solution.

Just to be sure, what version of maven are you running that requires no extra magic?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Benson Margulies
I use 2.2.1, but i bet the real reason i that I use the current
version of the assembly plugin.

On Wed, Dec 28, 2011 at 8:41 PM, entdeveloper
<[hidden email]> wrote:

> So I upgraded from maven 2.2.1 to maven 3.0.3, and now it seems to deploy
> correctly. My deploys are controlled from Hudson/Jenkins, so I'll need to
> figure out if I can do the upgrade there as well, assuming that is the
> actual solution.
>
> Just to be sure, what version of maven are you running that requires no
> extra magic?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Deploy-Multiple-Jars-to-Release-tp5106386p5106545.html
> Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
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: Deploy Multiple Jars to Release

entdeveloper
Well dangit, there goes that theory.

        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2.2</version>

look right? Are you using either of the <attach> or <classifier> config params? I pasted my config earlier in this email thread.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploy Multiple Jars to Release

Benson Margulies
<classifier/> is not in any of my configs, it's deprecated. I let
attach default to true.

Now I'm wondering about the deploy plugin and the wagons.

I'll look back the thread tomorrow.


On Wed, Dec 28, 2011 at 8:57 PM, entdeveloper
<[hidden email]> wrote:

> Well dangit, there goes that theory.
>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <version>2.2.2</version>
>
> look right? Are you using either of the <attach> or <classifier> config
> params? I pasted my config earlier in this email thread.
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Deploy-Multiple-Jars-to-Release-tp5106386p5106570.html
> Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
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: Deploy Multiple Jars to Release

Manfred Moser-4
In reply to this post by entdeveloper
On 11-12-28 05:41 PM, entdeveloper wrote:
> So I upgraded from maven 2.2.1 to maven 3.0.3, and now it seems to deploy
> correctly. My deploys are controlled from Hudson/Jenkins, so I'll need to
> figure out if I can do the upgrade there as well, assuming that is the
> actual solution.
>
> Just to be sure, what version of maven are you running that requires no
> extra magic?
>

3.0.3... I have not used 2.x for ages. Too much headaches like that..

--
Manfred Moser
http://simpligility.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: Deploy Multiple Jars to Release

entdeveloper
So I seem to have figured it out, and this is really stupid:

If I run 'mvn clean package deploy', which is what I was doing, it breaks

If I run 'mvn clean deploy', it works

Obviously I know these do the same thing, but having the extra 'package' goal in there shouldn't have REALLY affected the outcome, it's just redundant. Perhaps having the extra 'package' in there made maven think that the other jar was not 'attached'.

This was on maven 2.2.1, btw.

Anyway, problem solved. Thanks for the help.
Loading...