You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Joël Wijngaarde [Us Media]" <jo...@usmedia.nl> on 2003/07/21 13:27:25 UTC

Hoto use filters before compilation in Maven

Hi,

I'm building a web application for a client. During testing we deploy
the application on a staging server. There are some slight differences
between the configuration of the staging server and the live
environment. Mainly the 'web.xml' and the 'log4j.xml' files, but also
some slight differences in the .java files.

In ant we can use the filter tag to perform some changes. We first copy
the class files to a new folder using a filter rule and then compile the
filtered classes. 

Is there a 'standard' way of doing something similar in maven. Or does
it require creating 'pre-goals' in a 'maven.xml' file? How I could use
filtering inside a maven project?

I will try to add the answers received here in the maven wiki at:
http://wiki.codehaus.org/maven/CreatingWebApplications


Best regards,

Joel

-- 
Us Media
Stadhouderskade 115
1073 AX Amsterdam

t: +31 20 428 6868
f: +31 20 470 6905
w: http://www.usmedia.nl


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


Howto access properties set by war plugin in maven.xml

Posted by "Joël Wijngaarde [Us Media]" <jo...@usmedia.nl>.
Hi All,

Trying to create different goals to create different war files I tried
the following code to create a war containing different log4j config
files depending on the called goal.

I defined the 'war:staging' goal:

<goal name="war:staging" prereqs="war:webapp" 
      description="Create a WAR file for the staging server">

  <ant:echo>Building WAR ${pom.artifactId} for staging server</ant:echo>
  <ant:echo>Using log4j configuration: ${maven.war.webapp.dir}/WEB-INF/log4j-staging.xml</ant:echo>

  <ant:copy file="${maven.war.webapp.dir}/WEB-INF/log4j-staging.xml"
            tofile="${maven.war.webapp.dir}/WEB-INF/log4j.xml"/>

  <attainGoal name="war:war" />

</goal>

But I do not seem to be able to access the '${maven.war.webapp.dir}'
property from my script. It is empty when I echo the property. So, I was
wondering how I could access the properties set by the war plugin. And
how I can use them in additional defined goals


Sincerely,

Joel Wijngaarde


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


RE: Hoto use filters before compilation in Maven

Posted by Michal Maczka <mm...@interia.pl>.

> -----Original Message-----
> From: Joël Wijngaarde [Us Media] [mailto:joel@usmedia.nl]
> Sent: Monday, July 21, 2003 1:27 PM
> To: 'Maven Users List'
> Subject: Hoto use filters before compilation in Maven
>
>
> Hi,
>
> I'm building a web application for a client. During testing we deploy
> the application on a staging server. There are some slight differences
> between the configuration of the staging server and the live
> environment. Mainly the 'web.xml' and the 'log4j.xml' files, but also
> some slight differences in the .java files.
>
> In ant we can use the filter tag to perform some changes. We first copy
> the class files to a new folder using a filter rule and then compile the
> filtered classes.
>
> Is there a 'standard' way of doing something similar in maven. Or does
> it require creating 'pre-goals' in a 'maven.xml' file? How I could use
> filtering inside a maven project?
>
> I will try to add the answers received here in the maven wiki at:
> http://wiki.codehaus.org/maven/CreatingWebApplications
>
>

Currently in Maven you can do filtering of "resources".
see: http://maven.apache.org/reference/project-descriptor.html#resources

You cannot do this with Java classes (unless you do will create pre-goals).

Michal



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