Thanks a lot for detailed reply.

I'll elaborate what I want to achieve

1. I need to filter A.properties. This file has a property
name={filtered.name} that needs to be filtered with a default value at all
times except when generating a war for deployment on an application server.
This file is directly under src/main/resources. 

For this I have the following configured in pom.xml 

<plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
                <webResources>
                        <resource>
                                <directory>src/main/resources</directory>
                                <targetPath>WEB-INF/classes</targetPath>
                                <!-- Filter the properties file to replace
varibles with appropriate values -->
                                <filtering>true</filtering>
                                <includes>
                                        <include>*.properties</include>
                                </includes>
                        </resource>
                </webResources>
        </configuration>
        </plugin>
</plugins> 

<!-- turn filtering on for the project's resources directory -->
<resources>
        <resource>
                <directory>src/main/resources</directory>
                <!-- Filter the properties file to replace varibles with
appropriate values -->
                <filtering>true</filtering>
                <includes>
                  <include>*.properties</include>
                </includes>
        </resource>
</resources> 

2. I also have a folder store under src/main/resources. I want to copy this
to my default output directory classes directory where my compiled classes
reside, which I know is the common behavior.  But I do not want to filter
any files under this folder. 

I added this to the configuration for attaining this

<!-- turn filtering on for the project's resources directory -->
<resources>
        <resource>
                <directory>src/main/resources</directory>
                <!-- Filter the properties file to replace varibles with
appropriate values -->
                <filtering>true</filtering>
                <includes>
                  <include>*.properties</include>
                </includes>
                <excludes>
                  <exclude>*.pdf</exclude>
                  <exclude>*.xml</exclude>
                 </excludes>
        </resource>
</resources> 

But the files under the folder store still gets filtered. 

3 and 4. I need the folder store in the classes directory on my local
development machine for running the application locally, but then I do not
need it in the war file for deployment on the application server coz it
there is a different location for that directory on the server which is what
the value that is in the properties file that is being filtered pertains to. 

5. When i say war and classes, I mean classes folder on my development
machine and war file created for deployment. So the classes folder in the
war generated doesn't need the store folder under src/main/resources. 

I always do a mvn install for building my application. When I need to
generate a war for deployment I do mvn install -P <name of profile with
values for filtering>

1 - is your project  a .war project
   Yes it is a war project. It is bundled as a jar when deployed. I run it
from my IDE when on local which  is why i don't use the bundle when
developing. I jus access the classes folder thats generated from the build. 
2 - if you have resources that need filtering and some others that don't,
why don't you use ${} in resources that must be filtered and leave plain
text in resources that don't need to be filtered ?
   Thats what I have done i the properties file and that part works fine. 
3 - what do you mean by .war and .classes? are we talking about same
project? 
     Sorry, but i was referring to the classes folder in the output
directory and the classes folder in the war package. 

Thanks a bunch for this excellent reply though. I'm sorry I had not made
everything as clear as it should have been
-- 
View this message in context: 
http://www.nabble.com/Maven-install-tf4923928s177.html#a14134623
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to