You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rémy <re...@gmail.com> on 2010/01/25 17:36:01 UTC

Generate 2 war with the same POM

Hello,

I want to generate two war from the same project. I managed to solve the
problem with profiles, but I'm not satisfied with the solution.

In the POM I set this:

<profile>
 <id>test1</id>
 <build>
  <plugins>
   <plugin>
     <artifactId>maven-war-plugin</artifactId>
      <configuration> 
        <webResources>
         <resource>
          <directory>${basedir}/repoA</directory>
          <targetPath>repoA</targetPath>
         </resource>
         <resource>
          <directory>${basedir}/repoB</directory>
          <targetPath>repoB</targetPath>
         </resource>
        </webResources>
        <warName>warTest1</warName>
       </configuration>
       </plugin>
   </plugins>
 </build>
</profile>	
<profile>
 <id>test1</id>
 <build>
  <plugins>
   <plugin>
     <artifactId>maven-war-plugin</artifactId>
      <configuration> 
        <webResources>
         <resource>
          <directory>${basedir}/repoA</directory>
          <targetPath>repoA</targetPath>
         </resource>
         <resource>
          <directory>${basedir}/repoC</directory>
          <targetPath>repoC</targetPath>
         </resource>
        </webResources>
        <warName>warTest2</warName>
       </configuration>
       </plugin>
   </plugins>
 </build>
</profile>

How can I do to factorize some informations between differents profiles. In
the example above, I would like to factorize the adding of repo in the war.

Thank you.

Rémy

-- 
View this message in context: http://old.nabble.com/Generate-2-war-with-the-same-POM-tp27307985p27307985.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: Resource Filter files

Posted by Manuel Grau <ma...@gmail.com>.
You're welcome!!

2010/1/26 <Da...@sungard.com>

> Thanks Manuel!!
>
> -----Original Message-----
> From: Manuel Grau [mailto:mangrar@gmail.com]
> Sent: Monday, January 25, 2010 2:09 PM
> To: Maven Users List
> Subject: Re: Resource Filter files
>
> Yes, is possible, I did it in my work recently. But, there is a better way.
> Notice what I'm doing. I have 4 profiles, activated with a var called env.
> So, when I call maven I always do:
>
> mvn -Denv=pre compile (or anything)
>
> I have four files called ${env}.pom.properties. So, you can put this in
> your main build tag:
>
> <filters>
>        <filter>${env}.pom.properties</filter>
> <filters>
>
> So, when activate pre profile, the properties file loaded is
> pre.pom.properties.
>
> El 25/01/2010, a las 21:01, <Da...@sungard.com> escribió:
>
> > Is it possible to define filters by profile? See below for example.
> >
> >  <build>
> >    ...
> >    <filters>
> >      <filter> [a filter property] </filter>
> >    </filters>
> >    ...
> >  </build>
> >
> > Thanks,
> >
> > David
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
"Everything should be made as simple as possible, but not simpler" Albert
Einstein

RE: Resource Filter files

Posted by Da...@sungard.com.
Thanks Manuel!!

-----Original Message-----
From: Manuel Grau [mailto:mangrar@gmail.com] 
Sent: Monday, January 25, 2010 2:09 PM
To: Maven Users List
Subject: Re: Resource Filter files

Yes, is possible, I did it in my work recently. But, there is a better way. Notice what I'm doing. I have 4 profiles, activated with a var called env. So, when I call maven I always do:

mvn -Denv=pre compile (or anything)

I have four files called ${env}.pom.properties. So, you can put this in your main build tag:

<filters>
	<filter>${env}.pom.properties</filter>
<filters>

So, when activate pre profile, the properties file loaded is pre.pom.properties.

El 25/01/2010, a las 21:01, <Da...@sungard.com> escribió:

> Is it possible to define filters by profile? See below for example.
> 
>  <build>
>    ...
>    <filters>
>      <filter> [a filter property] </filter>
>    </filters>
>    ...
>  </build>
> 
> Thanks,
> 
> David



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


Re: Resource Filter files

Posted by Manuel Grau <ma...@gmail.com>.
Yes, is possible, I did it in my work recently. But, there is a better way. Notice what I'm doing. I have 4 profiles, activated with a var called env. So, when I call maven I always do:

mvn -Denv=pre compile (or anything)

I have four files called ${env}.pom.properties. So, you can put this in your main build tag:

<filters>
	<filter>${env}.pom.properties</filter>
<filters>

So, when activate pre profile, the properties file loaded is pre.pom.properties.

El 25/01/2010, a las 21:01, <Da...@sungard.com> escribió:

> Is it possible to define filters by profile? See below for example.
> 
>  <build>
>    ...
>    <filters>
>      <filter> [a filter property] </filter>
>    </filters>
>    ...
>  </build>
> 
> Thanks,
> 
> David


Resource Filter files

Posted by Da...@sungard.com.
Is it possible to define filters by profile? See below for example.

  <build>
    ...
    <filters>
      <filter> [a filter property] </filter>
    </filters>
    ...
  </build>

Thanks,

David

Re: Generate 2 war with the same POM

Posted by Anders Hammar <an...@hammar.net>.
Maven Golden rule: One project produces one artifact.
http://www.sonatype.com/people/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/


On Mon, Jan 25, 2010 at 17:36, Rémy <re...@gmail.com> wrote:

>
> Hello,
>
> I want to generate two war from the same project. I managed to solve the
> problem with profiles, but I'm not satisfied with the solution.
>
> In the POM I set this:
>
> <profile>
>  <id>test1</id>
>  <build>
>  <plugins>
>   <plugin>
>     <artifactId>maven-war-plugin</artifactId>
>      <configuration>
>        <webResources>
>         <resource>
>          <directory>${basedir}/repoA</directory>
>          <targetPath>repoA</targetPath>
>         </resource>
>         <resource>
>          <directory>${basedir}/repoB</directory>
>          <targetPath>repoB</targetPath>
>         </resource>
>        </webResources>
>        <warName>warTest1</warName>
>       </configuration>
>       </plugin>
>   </plugins>
>  </build>
> </profile>
> <profile>
>  <id>test1</id>
>  <build>
>  <plugins>
>   <plugin>
>     <artifactId>maven-war-plugin</artifactId>
>      <configuration>
>        <webResources>
>         <resource>
>          <directory>${basedir}/repoA</directory>
>          <targetPath>repoA</targetPath>
>         </resource>
>         <resource>
>          <directory>${basedir}/repoC</directory>
>          <targetPath>repoC</targetPath>
>         </resource>
>        </webResources>
>        <warName>warTest2</warName>
>       </configuration>
>       </plugin>
>   </plugins>
>  </build>
> </profile>
>
> How can I do to factorize some informations between differents profiles. In
> the example above, I would like to factorize the adding of repo in the war.
>
> Thank you.
>
> Rémy
>
> --
> View this message in context:
> http://old.nabble.com/Generate-2-war-with-the-same-POM-tp27307985p27307985.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
>
>