You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Heinrich Nirschl <he...@gmail.com> on 2007/04/27 22:57:54 UTC

Re: Filtering resources into a directory other than classes for a webapp?

On Fri, 2007-04-27 at 15:17 -0400, Jared Blitzstein wrote:
> Thanks, I've read that as well as http://maven.apache.org/guides/ 
> getting-started/index.html#How%20do%20I%20filter%20resource%20files  
> and it's basically the same thing as the WAR plugin...I believe.  
> Since I need this on both the WAR and the exploded app for jetty, I'm  
> not sure if the war plugin is what I need to be using. But the files  
> are actually being filtered, it's just they're not ending up in /WEB- 
> INF/config/ like I want.  They're going to /WEB-INF/classes/WEB-INF/ 
> config/. Here is the snippet from my pom
> 
> 		<filters>
> 			<filter>src/main/filters/${env}.var</filter>
> 		</filters>
> 		<resources>
> 			<resource>
> 				<directory>src/main/webapp/WEB-INF/config</directory>
> 				<filtering>true</filtering>
> 				<targetPath>WEB-INF/config/</targetPath>
> 			</resource>
> 		</resources>
> 
> 
> Any ideas?
> 

I have not tried this, but according to the documentation a
configuration similar to this for the war plugin should work:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
      <filters>
        <filter>src/main/filters/${env}.var</filter>
      </filters>
      <webResources>
         <resource>
           <!-- the config files you want to filter should be in this directory -->
           <directory>configurations</directory> 
           <targetPath>WEB-INF/config</targetPath>
           <!-- enable filtering -->
           <filtering>true</filtering>
         </resource>        
      </webResources>
    </configuration>
  </plugin>

- Henry


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


Re: Filtering resources into a directory other than classes for a webapp?

Posted by Jared Blitzstein <ma...@blitzstein.net>.
Yeah, looks like 2.0 doesn't work and when I switched it to 2.0.2 it  
worked right away.

On May 7, 2007, at 12:31 PM, stig.lau wrote:

>
> I was looking for the same solution, and the war-plugin seemed right.
> But my config files were always put in the war root instead of the  
> folder i
> specified.
> The solution for me was to use the 2.0.2 version of the war-plugin  
> instead
> of 2.0.
>
>
> Heinrich Nirschl wrote:
>>
>> On Fri, 2007-04-27 at 15:17 -0400, Jared Blitzstein wrote:
>>> Thanks, I've read that as well as http://maven.apache.org/guides/
>>> getting-started/index.html#How%20do%20I%20filter%20resource%20files
>>> and it's basically the same thing as the WAR plugin...I believe.
>>> Since I need this on both the WAR and the exploded app for jetty,  
>>> I'm
>>> not sure if the war plugin is what I need to be using. But the files
>>> are actually being filtered, it's just they're not ending up in / 
>>> WEB-
>>> INF/config/ like I want.  They're going to /WEB-INF/classes/WEB-INF/
>>> config/. Here is the snippet from my pom
>>>
>>> 		<filters>
>>> 			<filter>src/main/filters/${env}.var</filter>
>>> 		</filters>
>>> 		<resources>
>>> 			<resource>
>>> 				<directory>src/main/webapp/WEB-INF/config</directory>
>>> 				<filtering>true</filtering>
>>> 				<targetPath>WEB-INF/config/</targetPath>
>>> 			</resource>
>>> 		</resources>
>>>
>>>
>>> Any ideas?
>>>
>>
>> I have not tried this, but according to the documentation a
>> configuration similar to this for the war plugin should work:
>>
>>   <plugin>
>>     <groupId>org.apache.maven.plugins</groupId>
>>     <artifactId>maven-war-plugin</artifactId>
>>     <configuration>
>>       <filters>
>>         <filter>src/main/filters/${env}.var</filter>
>>       </filters>
>>       <webResources>
>>          <resource>
>>            <!-- the config files you want to filter should be in this
>> directory -->
>>            <directory>configurations</directory>
>>            <targetPath>WEB-INF/config</targetPath>
>>            <!-- enable filtering -->
>>            <filtering>true</filtering>
>>          </resource>
>>       </webResources>
>>     </configuration>
>>   </plugin>
>>
>> - Henry
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Filtering- 
> resources-into-a-directory-other-than-classes-for-a-webapp-- 
> tf3658613s177.html#a10360724
> 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
>


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


Re: Filtering resources into a directory other than classes for a webapp?

Posted by "stig.lau" <st...@lau.no>.
I was looking for the same solution, and the war-plugin seemed right. 
But my config files were always put in the war root instead of the folder i
specified.
The solution for me was to use the 2.0.2 version of the war-plugin instead
of 2.0.


Heinrich Nirschl wrote:
> 
> On Fri, 2007-04-27 at 15:17 -0400, Jared Blitzstein wrote:
>> Thanks, I've read that as well as http://maven.apache.org/guides/ 
>> getting-started/index.html#How%20do%20I%20filter%20resource%20files  
>> and it's basically the same thing as the WAR plugin...I believe.  
>> Since I need this on both the WAR and the exploded app for jetty, I'm  
>> not sure if the war plugin is what I need to be using. But the files  
>> are actually being filtered, it's just they're not ending up in /WEB- 
>> INF/config/ like I want.  They're going to /WEB-INF/classes/WEB-INF/ 
>> config/. Here is the snippet from my pom
>> 
>> 		<filters>
>> 			<filter>src/main/filters/${env}.var</filter>
>> 		</filters>
>> 		<resources>
>> 			<resource>
>> 				<directory>src/main/webapp/WEB-INF/config</directory>
>> 				<filtering>true</filtering>
>> 				<targetPath>WEB-INF/config/</targetPath>
>> 			</resource>
>> 		</resources>
>> 
>> 
>> Any ideas?
>> 
> 
> I have not tried this, but according to the documentation a
> configuration similar to this for the war plugin should work:
> 
>   <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-war-plugin</artifactId>
>     <configuration>
>       <filters>
>         <filter>src/main/filters/${env}.var</filter>
>       </filters>
>       <webResources>
>          <resource>
>            <!-- the config files you want to filter should be in this
> directory -->
>            <directory>configurations</directory> 
>            <targetPath>WEB-INF/config</targetPath>
>            <!-- enable filtering -->
>            <filtering>true</filtering>
>          </resource>        
>       </webResources>
>     </configuration>
>   </plugin>
> 
> - Henry
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Filtering-resources-into-a-directory-other-than-classes-for-a-webapp--tf3658613s177.html#a10360724
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