I can understand needing to do this. For reasons I won't get into, I had
to do something similar in order to split a huge jar file. 

The compile phase compiled all the classes I needed, so I used the
package phase to create 2 jars from the same sources by overriding the
default-jar execution and creating a second execution to create the
second, classified, jar, as shown below. Note the id=default-jar in the
first execution and the classifer=someClassifier in the second one.

Both get installed/deployed by default.

I suppose you could split the default-compile in a similar fashion if
that's where you're headed.

<plugin>
  <artifactId>maven-jar-plugin</artifactId>
    <executions>
        <execution>
          <id>default-jar</id>
          <phase>package</phase>
          <goals>
                <goal>jar</goal>
          </goals>
          <configuration>
                <!-- Include or exclude some classes -->
          </configuration>
        </execution>
        <execution>
          <id>classified-jar</id>
          <phase>package</phase>
          <goals>
                <goal>jar</goal>
        <goals>
        <configuration>
                <classifier>someClassifier</classifer>
                <!-- Include or exclude some classes -->
          </configuration>
    </execution>
  </executions>
</plugin>


HTH,
Matt


> -----Original Message-----
> From: Ansgar Konermann [mailto:[email protected]]
> Sent: Tuesday, February 28, 2012 2:09 PM
> To: Maven Users List
> Subject: Re: How to deploy with 'classifier'
> 
> Am 28.02.2012 22:02 schrieb "Billy Newman" <[email protected]>:
> >
> > So what is the recommended way to create different flavors of jars
> with a
> > 'classifier'?
> >
> > Also I don't see how I am fighting maven I am sure this is possible
> as
> > people build a 'sources' and 'javadoc' classifier within one module.
> 
> True. However, the main artifact has no classifier, even in these
> cases.
> Sources and javadoc are so-called "attached" artifacts, which derive
> their
> coordinates from those of the main artifact, plus the classifier.
> 
> Pick a different artifactId for your different flavours.
> 
> Best
> 
> Ansgar
> 
> >
> >
> > On Tue, Feb 28, 2012 at 1:48 PM, Stephen Connolly <
> > [email protected]> wrote:
> >
> > > You are fighting maven. One artifact one module
> > >
> > > Sent from my iPhone
> > >
> > > On 28 Feb 2012, at 19:40, Billy Newman <[email protected]>
wrote:
> > >
> > > > I have a pretty simple pom file setup to build a jar.  I can
> deploy
> to my
> > > > internal repository just fine.  However I want to build
different
> flavors
> > > > of my jar and use the 'classifier' tag  and deploy.
> > > >
> > > > However I can specify a 'classifier' in my pom file (with the
> > > > group/artifact id and version), and I cannot seem to find how to
> specifiy
> > > > the 'classifier' in the maven-deploy-plugin either.
> > > >
> > > > Since I am building with maven I do not want to use the deploy-
> file
> > > plugin.
> > > >
> > > > What am I missing?
> > > >
> > > > Thanks in advance.
> > >
> > >
-------------------------------------------------------------------
> --
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >

______________________________________________________________________
This message, including any attachments, is confidential and contains 
information intended only for the person(s) named above. Any other 
distribution, copying or disclosure is strictly prohibited. If you are not the 
intended recipient or have received this message in error, please notify us 
immediately by reply email and permanently delete the original transmission 
from all of your systems and hard drives, including any attachments, without 
making a copy.

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

Reply via email to