drippy schrieb:
This has all been helpful.  Now I am facing yet another challenge with this
setup.
when I run mvn -PprofileA clean install my (service module) pom file does
not generate the pom that goes into the repository.  It only places the jar
file into it.

Yes, that's how it works. The artifacts with classifiers are meant to be installed/deployed alongsite the main artifact (the one without a classifier) of your project. The pom is copied when you install the main artifact.

This way when I am attempting to access the jar file from
another module (my webapp module) by the classifier it is sometimes failing
and sometimes working.
>
It works if I manually move to the webapp module and run an install on the
webapp pom.  It will give me an error that says:

[WARNING] *** CHECKSUM FAILED - Error retrieving checksum file for
....SNAPSHOT.pom - IGNORING

However when it does this, it will generate those files (the pom and other
xml files) for me in my .m2 repository.  When it does this, it works.  The
time it doesn't work is if I am doing an install from the parent of both of
these.
I have in a parent pom multiple modules in which we do an install from:

<modules>
                <module>../model</module>
                <module>../persistence</module>
                <module>../service</module>
                <module>../webapp</module>
</modules>

if I call mvn -PprofileA clean install  from the parent pom containing this,
the webapp is not able to see the service jar file and doesn't attempt to
download it like it does when running the same command on the webapp pom
directly.

I can't entirely follow you here. I tried to make a little testproject following the setup you describe above and everything is working as I would expect it.

I sent you a private mail with the testproject attached, as the list is blocking attachements. Can you try if you can reproduce the errors with the testproject and report back here on the list.

I have attempted to tell it to <generatePom/> but that doesn't seem to be
functioning.
Any help?

Thanks again,
-Ben


-Tim


Tim Kettler wrote:
No, this is not possible (with the <finalName/> tag). The repository is a structured storage for maven artifacts and the directory hierarchy and filename conventions are well defined. Every artifact in the repository has to adhere to this conventions else maven will not be able to retrieve the artifacts.

However, there is a simple solution (and I don't know why I didn't thought at it in the first place):

Maven has the concept of classifiers to discriminate between different flavours of the same artifact. This is used for things like providing artifacts for different JDK versions or installing the javadoc and source archives alongsite the main artifact. As classifiers are part of the identity of a dependency, they are preserved in the repository.

To cut a long story short, this pom should do what you want:

   <project>
     <modelVersion>4.0.0</modelVersion>

     <groupId>mygroup</groupId>
     <artifactId>myartifact</artifactId>
     <version>0.1-SNAPSHOT</version>

     <profiles>
       <profile>
         <id>profileA</id>
         <build>
           <plugins>
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <configuration>
                 <classifier>profilea</classifier>
               </configuration>
             </plugin>
           </plugins>
         </build>
       </profile>

       <profile>
         <id>profileB</id>
         <build>
           <plugins>
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <configuration>
                 <classifier>profileb</classifier>
               </configuration>
             </plugin>
           </plugins>
         </build>
       </profile>
     </profiles>
   </project>

-Tim

drippy schrieb:
Thanks Tim, that does work when packaging the jar.  Now I realize that I
also
need the name to stay when I am running install. Is this an option?
-Ben


Tim Kettler wrote:
Hi,

you can use <build/><finalName/> for this.

-Tim

drippy schrieb:
I have two profiles that I am using.  I'm trying to figure out if there
is a
way to make it so that when I package up a jar file I can specify the
name
of the jar file so that it is identifiable for that profile.

TIA,
Ben
---------------------------------------------------------------------
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]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to