As others have mentioned, profiles are the proper way to proceed with this requirement. This same thing was just discussed in the last day or two, so check the archives or Nabble.com and you're bound to find more examples and discussion on this topic.
About the "URGENT" in your subject -- I'd leave that out of future emails. Every question on this list is urgent to the person who needs the help. If anything, I actually go a little out of my way to IGNORE these emails. Just FYI... Wayne On 6/28/07, Terala, Satish (IS Consultant) <[EMAIL PROTECTED]> wrote:
You should do this using profiles. Typically you would define a profile for each environment <profile> <id>dev</id> <activation> <property> <name>target-env</name> <value>dev</value> </property> </activation> <properties> <resource.filter.file>src/main/filters/dev.filter.properties</resource.f ilter.file> </properties> </profile> Depending on the env you want to build for dev/prod/stage , you can pass in the appropriate value with -Dtarget-env=<env.name> when running a maven goal. I am not sure if you have a plugin that will rename the files (you can definitely use a ant task to do that), instead the way its recommended is by using a filter file instead. Have the application.xml define variables for property values you want to change, and replace those with values from the appropriate environment filters file. -Satish -----Original Message----- From: Vaidya, Supriya A (US - Chicago) [mailto:[EMAIL PROTECTED] Sent: Thursday, June 28, 2007 5:49 PM To: users@maven.apache.org Subject: URGENT: Renaming files during compile time Hi: Here is what needs to be achieved: I have 3 different configuration files: application-dev.properties, application-int.properties, application-prod.properties. Depending on the value taken by a certain variable (where and how do shoudl I define this variable??), I need to have one of the above files copied to a certain directory, and renamed. How do I achieve this with Maven? I have tried using the maven-dependency-plugin, but am not sure how to define the artifacts... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>my-application</groupId> <artifactId>application-prod.xml</artifactId> <type>file</type> <overWrite>false</overWrite> <outputDirectory>${project.build.directory}</outputDirectory> <destFileName>application.xml</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [v.E.1] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]