You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rebholz Paul <Pa...@six-group.com> on 2009/12/22 16:12:31 UTC

ear-plugin and profiles: poor cooperation?

> Hi all!
> 
> We have a project producing an ear artifact. The contents of the ear
> file are configured with the maven-ear-plugin. In profiles we want to
> be able to flexibly add more artifacts to the ear file as shown in the
> example below. Our tests so far revealed a different behaviour than
> expected. When adding a jar file with the jarModule element, all other
> entries corresponding to jarModules disappear in the application.xml
> and even some other jar files disappear completely from the ear.
> Moreover, when adding a second profile adding jars, the first is
> eclipsed. Is this a bug in the maven-ear-plugin implementation?
> 
> Regards, Paul
> 
> 
>     <profile>
>       <id>my_test</id>
>       <activation>
>         <property>
>           <name>my_switch</name>
>           <value>true</value>
>         </property>
>       </activation>
>       <build>
>         <plugins>
>           <plugin>
>             <artifactId>maven-ear-plugin</artifactId>
>             <configuration>
>               <modules>
>                 <jarModule>
>                   <groupId>quartz</groupId>
>                   <artifactId>quartz</artifactId>
>  
> <includeInApplicationXml>true</includeInApplicationXml>
>                 </jarModule>
>               </modules>
>             </configuration>
>           </plugin>
>         </plugins>
>       </build>
>       <dependencies>
>         <dependency>
>         	<groupId>quartz</groupId>
> 	<artifactId>quartz</artifactId>
> 	<type>jar</type>
> 	<version>1.5.2</version>
>         </dependency>
>       </dependencies>
>     </profile> 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. 
The sender's company reserves the right to monitor all e-mail communications through their networks.

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


Re: ear-plugin and profiles: poor cooperation?

Posted by Anders Hammar <an...@hammar.net>.
Well, first I would work very hard to be able to use the EXACT same ear in
both testing and production. You want to test the very same thing that you
put in production, IMO.

Instead of using profiles, I would have two different projects - one
producing the ear for testing and the other producing the one for
production. By doing so you can produce both ears in one build. Possibly you
could just have one project and produce the ear for production as the
primary artifact and then the one for testing with a classifier. Having two
different projects is probably easier.

/Anders

On Wed, Dec 23, 2009 at 10:54, Rebholz Paul <Pa...@six-group.com>wrote:

> Hi Anders
>
> We need one and the same ear to contain additional jars in testing,
> while for release we want to only include the core jars. This is the
> rationale in trying to use a profile. If you can advise us on how to
> achieve our goal through different means, we'd highly appreciate.
>
> Cheers, Paul.
>
> -----Original Message-----
> From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On
> Behalf Of Anders Hammar
> Sent: Dienstag, 22. Dezember 2009 17:51
> To: Maven Users List
> Subject: Re: ear-plugin and profiles: poor cooperation?
>
> I believe that the behavior you see is correct. Maybe not what you want
> though...:-)
> If you explain why you sometimes would like to add more jars wee could
> suggest a different solution.
>
> /Anders
>
> On Tue, Dec 22, 2009 at 16:12, Rebholz Paul
> <Pa...@six-group.com>wrote:
>
> > > Hi all!
> > >
> > > We have a project producing an ear artifact. The contents of the ear
> > > file are configured with the maven-ear-plugin. In profiles we want
> to
> > > be able to flexibly add more artifacts to the ear file as shown in
> the
> > > example below. Our tests so far revealed a different behaviour than
> > > expected. When adding a jar file with the jarModule element, all
> other
> > > entries corresponding to jarModules disappear in the application.xml
> > > and even some other jar files disappear completely from the ear.
> > > Moreover, when adding a second profile adding jars, the first is
> > > eclipsed. Is this a bug in the maven-ear-plugin implementation?
> > >
> > > Regards, Paul
> > >
> > >
> > >     <profile>
> > >       <id>my_test</id>
> > >       <activation>
> > >         <property>
> > >           <name>my_switch</name>
> > >           <value>true</value>
> > >         </property>
> > >       </activation>
> > >       <build>
> > >         <plugins>
> > >           <plugin>
> > >             <artifactId>maven-ear-plugin</artifactId>
> > >             <configuration>
> > >               <modules>
> > >                 <jarModule>
> > >                   <groupId>quartz</groupId>
> > >                   <artifactId>quartz</artifactId>
> > >
> > > <includeInApplicationXml>true</includeInApplicationXml>
> > >                 </jarModule>
> > >               </modules>
> > >             </configuration>
> > >           </plugin>
> > >         </plugins>
> > >       </build>
> > >       <dependencies>
> > >         <dependency>
> > >               <groupId>quartz</groupId>
> > >       <artifactId>quartz</artifactId>
> > >       <type>jar</type>
> > >       <version>1.5.2</version>
> > >         </dependency>
> > >       </dependencies>
> > >     </profile>
> >
> > This message is for the named person's use only. It may contain
> > confidential, proprietary or legally privileged information. If you
> receive
> > this message in error, please notify the sender urgently and then
> > immediately delete the message and any copies of it from your system.
> Please
> > also immediately destroy any hardcopies of the message.
> > The sender's company reserves the right to monitor all e-mail
> > communications through their networks.
> >
> > ---------------------------------------------------------------------
> > 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: ear-plugin and profiles: poor cooperation?

Posted by Rebholz Paul <Pa...@six-group.com>.
Hi Anders

We need one and the same ear to contain additional jars in testing,
while for release we want to only include the core jars. This is the
rationale in trying to use a profile. If you can advise us on how to
achieve our goal through different means, we'd highly appreciate. 

Cheers, Paul. 

-----Original Message-----
From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On
Behalf Of Anders Hammar
Sent: Dienstag, 22. Dezember 2009 17:51
To: Maven Users List
Subject: Re: ear-plugin and profiles: poor cooperation?

I believe that the behavior you see is correct. Maybe not what you want
though...:-)
If you explain why you sometimes would like to add more jars wee could
suggest a different solution.

/Anders

On Tue, Dec 22, 2009 at 16:12, Rebholz Paul
<Pa...@six-group.com>wrote:

> > Hi all!
> >
> > We have a project producing an ear artifact. The contents of the ear
> > file are configured with the maven-ear-plugin. In profiles we want
to
> > be able to flexibly add more artifacts to the ear file as shown in
the
> > example below. Our tests so far revealed a different behaviour than
> > expected. When adding a jar file with the jarModule element, all
other
> > entries corresponding to jarModules disappear in the application.xml
> > and even some other jar files disappear completely from the ear.
> > Moreover, when adding a second profile adding jars, the first is
> > eclipsed. Is this a bug in the maven-ear-plugin implementation?
> >
> > Regards, Paul
> >
> >
> >     <profile>
> >       <id>my_test</id>
> >       <activation>
> >         <property>
> >           <name>my_switch</name>
> >           <value>true</value>
> >         </property>
> >       </activation>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <artifactId>maven-ear-plugin</artifactId>
> >             <configuration>
> >               <modules>
> >                 <jarModule>
> >                   <groupId>quartz</groupId>
> >                   <artifactId>quartz</artifactId>
> >
> > <includeInApplicationXml>true</includeInApplicationXml>
> >                 </jarModule>
> >               </modules>
> >             </configuration>
> >           </plugin>
> >         </plugins>
> >       </build>
> >       <dependencies>
> >         <dependency>
> >               <groupId>quartz</groupId>
> >       <artifactId>quartz</artifactId>
> >       <type>jar</type>
> >       <version>1.5.2</version>
> >         </dependency>
> >       </dependencies>
> >     </profile>
>
> This message is for the named person's use only. It may contain
> confidential, proprietary or legally privileged information. If you
receive
> this message in error, please notify the sender urgently and then
> immediately delete the message and any copies of it from your system.
Please
> also immediately destroy any hardcopies of the message.
> The sender's company reserves the right to monitor all e-mail
> communications through their networks.
>
> ---------------------------------------------------------------------
> 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: ear-plugin and profiles: poor cooperation?

Posted by Anders Hammar <an...@hammar.net>.
I believe that the behavior you see is correct. Maybe not what you want
though...:-)
If you explain why you sometimes would like to add more jars wee could
suggest a different solution.

/Anders

On Tue, Dec 22, 2009 at 16:12, Rebholz Paul <Pa...@six-group.com>wrote:

> > Hi all!
> >
> > We have a project producing an ear artifact. The contents of the ear
> > file are configured with the maven-ear-plugin. In profiles we want to
> > be able to flexibly add more artifacts to the ear file as shown in the
> > example below. Our tests so far revealed a different behaviour than
> > expected. When adding a jar file with the jarModule element, all other
> > entries corresponding to jarModules disappear in the application.xml
> > and even some other jar files disappear completely from the ear.
> > Moreover, when adding a second profile adding jars, the first is
> > eclipsed. Is this a bug in the maven-ear-plugin implementation?
> >
> > Regards, Paul
> >
> >
> >     <profile>
> >       <id>my_test</id>
> >       <activation>
> >         <property>
> >           <name>my_switch</name>
> >           <value>true</value>
> >         </property>
> >       </activation>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <artifactId>maven-ear-plugin</artifactId>
> >             <configuration>
> >               <modules>
> >                 <jarModule>
> >                   <groupId>quartz</groupId>
> >                   <artifactId>quartz</artifactId>
> >
> > <includeInApplicationXml>true</includeInApplicationXml>
> >                 </jarModule>
> >               </modules>
> >             </configuration>
> >           </plugin>
> >         </plugins>
> >       </build>
> >       <dependencies>
> >         <dependency>
> >               <groupId>quartz</groupId>
> >       <artifactId>quartz</artifactId>
> >       <type>jar</type>
> >       <version>1.5.2</version>
> >         </dependency>
> >       </dependencies>
> >     </profile>
>
> This message is for the named person's use only. It may contain
> confidential, proprietary or legally privileged information. If you receive
> this message in error, please notify the sender urgently and then
> immediately delete the message and any copies of it from your system. Please
> also immediately destroy any hardcopies of the message.
> The sender's company reserves the right to monitor all e-mail
> communications through their networks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: ear-plugin and profiles: poor cooperation?

Posted by boraldo <bo...@hotbox.ru>.
I have the same problem and I'd like to explain it.
I want to have an ability to add some web-modules to my ear in some profile.
And I don't want to redefine other modules, only my module. If I only add
dependency on my module in profile, it's context root will be equal to war
name, but I want to set it manually.



snicoll wrote:
> 
> A configuration item that is a list can't be merged in a profile. See the
> "modules" element as a configuration item, like the JavaEE version you
> want
> to use. If you override the value in the profile, you can't expect it to
> merge the elements that are set in the main build (this is a global
> behavior
> of Maven btw).
> 
> Why don't you add a dependency section in your profile instead? Why
> quartz.jar should be added to the application context? Maybe you need to
> use
> http://maven.apache.org/plugins/maven-ear-plugin/generate-application-xml-mojo.html#includeLibInApplicationXmlinstead.
> 
> Regards,
> Stéphane
> 
> On Tue, Dec 22, 2009 at 4:12 PM, Rebholz Paul
> <Pa...@six-group.com>wrote:
> 
>> > Hi all!
>> >
>> > We have a project producing an ear artifact. The contents of the ear
>> > file are configured with the maven-ear-plugin. In profiles we want to
>> > be able to flexibly add more artifacts to the ear file as shown in the
>> > example below. Our tests so far revealed a different behaviour than
>> > expected. When adding a jar file with the jarModule element, all other
>> > entries corresponding to jarModules disappear in the application.xml
>> > and even some other jar files disappear completely from the ear.
>> > Moreover, when adding a second profile adding jars, the first is
>> > eclipsed. Is this a bug in the maven-ear-plugin implementation?
>> >
>> > Regards, Paul
>> >
>> >
>> >     <profile>
>> >       <id>my_test</id>
>> >       <activation>
>> >         <property>
>> >           <name>my_switch</name>
>> >           <value>true</value>
>> >         </property>
>> >       </activation>
>> >       <build>
>> >         <plugins>
>> >           <plugin>
>> >             <artifactId>maven-ear-plugin</artifactId>
>> >             <configuration>
>> >               <modules>
>> >                 <jarModule>
>> >                   <groupId>quartz</groupId>
>> >                   <artifactId>quartz</artifactId>
>> >
>> > <includeInApplicationXml>true</includeInApplicationXml>
>> >                 </jarModule>
>> >               </modules>
>> >             </configuration>
>> >           </plugin>
>> >         </plugins>
>> >       </build>
>> >       <dependencies>
>> >         <dependency>
>> >               <groupId>quartz</groupId>
>> >       <artifactId>quartz</artifactId>
>> >       <type>jar</type>
>> >       <version>1.5.2</version>
>> >         </dependency>
>> >       </dependencies>
>> >     </profile>
>>
>> This message is for the named person's use only. It may contain
>> confidential, proprietary or legally privileged information. If you
>> receive
>> this message in error, please notify the sender urgently and then
>> immediately delete the message and any copies of it from your system.
>> Please
>> also immediately destroy any hardcopies of the message.
>> The sender's company reserves the right to monitor all e-mail
>> communications through their networks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> -- 
> Large Systems Suck: This rule is 100% transitive. If you build one, you
> suck" -- S.Yegge
> 
> 

-- 
View this message in context: http://old.nabble.com/ear-plugin-and-profiles%3A-poor-cooperation--tp26889824p27452223.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: ear-plugin and profiles: poor cooperation?

Posted by Stephane Nicoll <st...@gmail.com>.
A configuration item that is a list can't be merged in a profile. See the
"modules" element as a configuration item, like the JavaEE version you want
to use. If you override the value in the profile, you can't expect it to
merge the elements that are set in the main build (this is a global behavior
of Maven btw).

Why don't you add a dependency section in your profile instead? Why
quartz.jar should be added to the application context? Maybe you need to use
http://maven.apache.org/plugins/maven-ear-plugin/generate-application-xml-mojo.html#includeLibInApplicationXmlinstead.

Regards,
Stéphane

On Tue, Dec 22, 2009 at 4:12 PM, Rebholz Paul <Pa...@six-group.com>wrote:

> > Hi all!
> >
> > We have a project producing an ear artifact. The contents of the ear
> > file are configured with the maven-ear-plugin. In profiles we want to
> > be able to flexibly add more artifacts to the ear file as shown in the
> > example below. Our tests so far revealed a different behaviour than
> > expected. When adding a jar file with the jarModule element, all other
> > entries corresponding to jarModules disappear in the application.xml
> > and even some other jar files disappear completely from the ear.
> > Moreover, when adding a second profile adding jars, the first is
> > eclipsed. Is this a bug in the maven-ear-plugin implementation?
> >
> > Regards, Paul
> >
> >
> >     <profile>
> >       <id>my_test</id>
> >       <activation>
> >         <property>
> >           <name>my_switch</name>
> >           <value>true</value>
> >         </property>
> >       </activation>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <artifactId>maven-ear-plugin</artifactId>
> >             <configuration>
> >               <modules>
> >                 <jarModule>
> >                   <groupId>quartz</groupId>
> >                   <artifactId>quartz</artifactId>
> >
> > <includeInApplicationXml>true</includeInApplicationXml>
> >                 </jarModule>
> >               </modules>
> >             </configuration>
> >           </plugin>
> >         </plugins>
> >       </build>
> >       <dependencies>
> >         <dependency>
> >               <groupId>quartz</groupId>
> >       <artifactId>quartz</artifactId>
> >       <type>jar</type>
> >       <version>1.5.2</version>
> >         </dependency>
> >       </dependencies>
> >     </profile>
>
> This message is for the named person's use only. It may contain
> confidential, proprietary or legally privileged information. If you receive
> this message in error, please notify the sender urgently and then
> immediately delete the message and any copies of it from your system. Please
> also immediately destroy any hardcopies of the message.
> The sender's company reserves the right to monitor all e-mail
> communications through their networks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Large Systems Suck: This rule is 100% transitive. If you build one, you
suck" -- S.Yegge