You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Niklas Grossmann <NG...@gmx.net> on 2009/04/22 11:03:29 UTC

pom does not get installed, if classifier used

Hi All,

when I do a 'mvn install' and the maven jar/ejb plugin is configured to use a classifier e.g.
...
<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <classifier>dev</classifier>
    </configuration>
</plugin>
...

only the .jar file gets installed in the local repository. If I don't use a classifier the pom gets installed alongside the .jar file. and maven-metadata-local.xml file is created in the directory above.

Is not installing the pom if a classifier is used the intended behaviour?

I'm using Maven 2.0.10 and tested this only for jar and ejb types.

Thanks,
  Niklas.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: pom does not get installed, if classifier used

Posted by Stephen Connolly <st...@gmail.com>.
Hmmmm...

what I would do is run two executions of the jar plugin...

execution #1 generates the artifact without a classifier but excludes the
persistance.xml

execution #2 generates the artifact with the classifier and includes the
persistance.xml

That would at least work around your issue (as you now have an artifact with
no classifier) and the artifact without the classifier makes sense

-Stephen

2009/4/23 Niklas Grossmann <NG...@gmx.net>

> Since nobody answered my question I'll try to explain why I think this is a
> problem. I use profiles and filters to adjust e.g. persistence.xml files to
> a given environment, e.g. dev, staging, prd. Because the persistence.xml
> file is part of the installed artifact I use classifiers to distinguish
> between them, e.g. ejb-module-1.0-SNAPSHOT-dev.jar is different form
> ejb-module-1.0-SNAPSHOT-stg.jar.
>
> I never do a build without classifier. Due to the fact that the pom does
> not get installed when a classifier is used (see below) dependency
> resolution fails, e.g. if I add ejb-module-1.0-SNAPSHOT-stg as dependency to
> an EAR, the EAR will contain ejb-module-1.0-SNAPSHOT-stg.jar but not its
> dependencies.
>
> To reproduce this simply create an empty project with the following pom:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
> ">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>test</groupId>
>  <artifactId>classifier-test</artifactId>
>  <version>0.0.1-SNAPSHOT</version>
>  <build>
>        <plugins>
>                <plugin>
>                        <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-jar-plugin</artifactId>
>                        <configuration>
>                                 <classifier>${myEnv}</classifier>
>                        </configuration>
>                </plugin>
>        </plugins>
>  </build>
>  <dependencies>
>    <dependency>
>      <groupId>commons-logging</groupId>
>      <artifactId>commons-logging</artifactId>
>      <version>1.1.1</version>
>      <scope>compile</scope>
>    </dependency>
>  </dependencies>
> </project>
>
> $ mvn -DmyEnv=dev install
> $ ls -R .m2/repository/test/classifier-test/
> .m2/repository/test/classifier-test/:
> 0.0.1-SNAPSHOT
>
> .m2/repository/test/classifier-test/0.0.1-SNAPSHOT:
> classifier-test-0.0.1-SNAPSHOT-dev.jar
>
> $ mvn -DmyEnv= install
> $ ls -R .m2/repository/test/classifier-test/
> .m2/repository/test/classifier-test/:
> 0.0.1-SNAPSHOT  maven-metadata-local.xml
>
> .m2/repository/test/classifier-test/0.0.1-SNAPSHOT:
> classifier-test-0.0.1-SNAPSHOT-dev.jar  classifier-test-0.0.1-SNAPSHOT.pom
> classifier-test-0.0.1-SNAPSHOT.jar      maven-metadata-local.xml
>
> I tested this with maven 2.0.9, 2.0.10, 2.1.0 and 3.0-alpha-1.
>
> Thanks,
>   Niklas.
>
> > Hi All,
> >
> > when I do a 'mvn install' and the maven jar/ejb plugin is configured to
> > use a classifier e.g.
> > ...
> > <plugin>
> >     <artifactId>maven-jar-plugin</artifactId>
> >     <configuration>
> >         <classifier>dev</classifier>
> >     </configuration>
> > </plugin>
> > ...
> >
> > only the .jar file gets installed in the local repository. If I don't use
> > a classifier the pom gets installed alongside the .jar file. and
> > maven-metadata-local.xml file is created in the directory above.
> >
> > Is not installing the pom if a classifier is used the intended behaviour?
> >
> > I'm using Maven 2.0.10 and tested this only for jar and ejb types.
> >
> > Thanks,
> >   Niklas.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: pom does not get installed, if classifier used

Posted by Niklas Grossmann <NG...@gmx.net>.
Since nobody answered my question I'll try to explain why I think this is a problem. I use profiles and filters to adjust e.g. persistence.xml files to a given environment, e.g. dev, staging, prd. Because the persistence.xml file is part of the installed artifact I use classifiers to distinguish between them, e.g. ejb-module-1.0-SNAPSHOT-dev.jar is different form ejb-module-1.0-SNAPSHOT-stg.jar.

I never do a build without classifier. Due to the fact that the pom does not get installed when a classifier is used (see below) dependency resolution fails, e.g. if I add ejb-module-1.0-SNAPSHOT-stg as dependency to an EAR, the EAR will contain ejb-module-1.0-SNAPSHOT-stg.jar but not its dependencies.

To reproduce this simply create an empty project with the following pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>classifier-test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
  	<plugins>
  		<plugin>
  			<groupId>org.apache.maven.plugins</groupId>
  			<artifactId>maven-jar-plugin</artifactId>
  			<configuration>
  				<classifier>${myEnv}</classifier>
  			</configuration>
  		</plugin>
  	</plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

$ mvn -DmyEnv=dev install
$ ls -R .m2/repository/test/classifier-test/
.m2/repository/test/classifier-test/:
0.0.1-SNAPSHOT

.m2/repository/test/classifier-test/0.0.1-SNAPSHOT:
classifier-test-0.0.1-SNAPSHOT-dev.jar

$ mvn -DmyEnv= install
$ ls -R .m2/repository/test/classifier-test/
.m2/repository/test/classifier-test/:
0.0.1-SNAPSHOT  maven-metadata-local.xml

.m2/repository/test/classifier-test/0.0.1-SNAPSHOT:
classifier-test-0.0.1-SNAPSHOT-dev.jar  classifier-test-0.0.1-SNAPSHOT.pom
classifier-test-0.0.1-SNAPSHOT.jar      maven-metadata-local.xml

I tested this with maven 2.0.9, 2.0.10, 2.1.0 and 3.0-alpha-1.

Thanks,
  Niklas.

> Hi All,
> 
> when I do a 'mvn install' and the maven jar/ejb plugin is configured to
> use a classifier e.g.
> ...
> <plugin>
>     <artifactId>maven-jar-plugin</artifactId>
>     <configuration>
>         <classifier>dev</classifier>
>     </configuration>
> </plugin>
> ...
> 
> only the .jar file gets installed in the local repository. If I don't use
> a classifier the pom gets installed alongside the .jar file. and
> maven-metadata-local.xml file is created in the directory above.
> 
> Is not installing the pom if a classifier is used the intended behaviour?
> 
> I'm using Maven 2.0.10 and tested this only for jar and ejb types.
> 
> Thanks,
>   Niklas.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: pom does not get installed, if classifier used

Posted by Niklas Grossmann <NG...@gmx.net>.
> >
> > Is not installing the pom if a classifier is used the intended
> behaviour?
> 
> No, it was reported and fixed in version 2.3 of the install plugin.
> What version are you using?  Depending on what version is set in the
> super pom inside Maven, you may need to specify a later version to
> pick up the fix.
> 
> http://jira.codehaus.org/browse/MINSTALL-41
Up to now I did not configure any version of the install plugin thus Maven's root pom version was used which seems to be 2.2, at least for 2.1.0. 
I set the version to 2.3 and the pom gets install now.

Thanks for you help.

Niklas.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: pom does not get installed, if classifier used

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 22, 2009 at 2:03 AM, Niklas Grossmann <NG...@gmx.net> wrote:
> Hi All,
>
> when I do a 'mvn install' and the maven jar/ejb plugin is configured to use a classifier e.g.
> ...
> only the .jar file gets installed in the local repository. If I don't use a classifier the pom gets installed alongside the .jar file. and maven-metadata-local.xml file is created in the directory above.
>
> Is not installing the pom if a classifier is used the intended behaviour?

No, it was reported and fixed in version 2.3 of the install plugin.
What version are you using?  Depending on what version is set in the
super pom inside Maven, you may need to specify a later version to
pick up the fix.

http://jira.codehaus.org/browse/MINSTALL-41

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org