You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Raffaele <r....@prismasw.it> on 2008/10/31 16:21:48 UTC

WAR plugin misunderstanding

Hi all,
I have yet a question about correct using of WAR plugin, I'll try to
describe my scenario:

Here it is a part of my project structure:

| configuration
|- dev
|-- WEB-INF
|--- repository.xml 
| src
|- main
|-- webapp
|--- WEB-INF
|---- repository.xml

As you can see, I have two respository.xml, one to be used during
development releases and the other one to be used as default release.

I would like to control though profiles, dev releases and default releases,
and so my pom (a part of it)is:

...
<profile>
  <id>dev</id>
    <build>
      <plugins>
        <plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-war-plugin</artifactId>
	  <version>2.1-alpha-2</version>
	  <configuration>	               
	  <webResources>
            <resource>
              <directory>configuration/release</directory>  
            </resource>
         </webResources>
         </configuration>
      </plugin>
   </plugins>
  </build>
</profile>
...

After executing of mvn clean package -P dev I would like to see inside 
|target
|- my-webapp
|-- WEB-INF
|--- repository.xml (the profile dev version)

But I'm continueing see default repository.xml?

Probably it's happening that first it is written dev repository.xml and then
it is overwritten with default repository.xml....in your opinion that's
possible?

Anyway, is there a way to decide ordering of resources that are packaged
inside war? Or can you give another solution or best practice?

Thanks in advance, best regards
Raffaele

-- 
View this message in context: http://www.nabble.com/WAR-plugin-misunderstanding-tp20268175p20268175.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: WAR plugin misunderstanding

Posted by Wayne Fay <wa...@gmail.com>.
> Each one of those profiles has its repository.xml file, and I would like
> that when I run mvn package -P "one of those profiles" the correct
> repository.xml file went to final packaged war.

Generally, you would do this with a single repository.xml file and use
filtering to set the environment-specific values in it. This is
detailed in "Better Builds with Maven" and other documentation online.

Alternatively you might include all the xml files and somehow pick the
proper one to load at runtime. This is considered a superior approach
as it does not result in environment-specific WAR files.

Wayne

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


Re: WAR plugin misunderstanding

Posted by Raffaele <r....@prismasw.it>.
Ok, perhaps I was not able to describe properly my issue, I try with other
words:

How could I do to achieve this:

My web app project has obviously the ...src\main\webapp\WEB-INF folder with
inside some xml file, for example web.xml, repository.xml and others...

I would like to manage some profiles different from the default, for example
a dev profile, a release profile and a test profile.
Each one of those profiles has its repository.xml file, and I would like
that when I run mvn package -P "one of those profiles" the correct
repository.xml file went to final packaged war.

I tried configuring war plugin in the way described in my previous post, but
it seems not working...I imagine my problem is quite common for all
develoepers...

Thanks again and best regards
Raffaele
-- 
View this message in context: http://www.nabble.com/WAR-plugin-misunderstanding-tp20268175p20298645.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: WAR plugin misunderstanding

Posted by Raffaele <r....@prismasw.it>.
> Is this directory correct? Above you named it "configuration/dev" instead
of "configuration/release".

Hi Martin,
the directory is correct, I simply made an error in writing my first
post...."configuration/dev"  is correct

> Is the profile active? You can verify this by executing "mvn -P dev
help:active-profiles".

Yes, obviuosly the profile is active, in fact it works fine for other
things...

Can you replicate my settings in a simple (also empty) web app using the
configuration for war plugin that I've written in first post?
How can I contact war plugin developers to ask them?
And above all, in my second post I've written in more general words what I
would like to obtain.

Thanks again and best regards
Raffaele
 


-- 
View this message in context: http://www.nabble.com/WAR-plugin-misunderstanding-tp20268175p20302967.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: WAR plugin misunderstanding

Posted by Martin Höller <ma...@xss.co.at>.
On 31 Oct 2008, Raffaele wrote:

> 
> Hi all,
> I have yet a question about correct using of WAR plugin, I'll try to
> describe my scenario:
> 
> Here it is a part of my project structure:
> 
> | configuration
> |- dev
> |-- WEB-INF
> |--- repository.xml 
> | src
> |- main
> |-- webapp
> |--- WEB-INF
> |---- repository.xml
> 
> As you can see, I have two respository.xml, one to be used during
> development releases and the other one to be used as default release.
> 
> I would like to control though profiles, dev releases and default releases,
> and so my pom (a part of it)is:
> 
> ...
> <profile>
>   <id>dev</id>
>     <build>
>       <plugins>
>         <plugin>
> 	  <groupId>org.apache.maven.plugins</groupId>
> 	  <artifactId>maven-war-plugin</artifactId>
> 	  <version>2.1-alpha-2</version>
> 	  <configuration>	               
> 	  <webResources>
>             <resource>
>               <directory>configuration/release</directory>  

Is this directory correct? Above you named it "configuration/dev" instead
of "configuration/release".

>             </resource>
>          </webResources>
>          </configuration>
>       </plugin>
>    </plugins>
>   </build>
> </profile>
> ...
> 
> After executing of mvn clean package -P dev I would like to see inside 
> |target
> |- my-webapp
> |-- WEB-INF
> |--- repository.xml (the profile dev version)
> 
> But I'm continueing see default repository.xml?


Is the profile active? You can verify this by executing "mvn -P dev
help:active-profiles".

hth,
- martin