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 <[email protected]>

> 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: [email protected]
> > For additional commands, e-mail: [email protected]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to