maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jackman" <David.Jack...@fastsearch.com>
Subject RE: [m2 & m1]Inject POM values into application
Date Wed, 19 Oct 2005 16:36:58 GMT
In m2, you just turn filtering on for resources in your pom.  Assuming
you've put the files being filtered in the default place
(src/main/resources), you may not have anything about resources in your
pom already, so you'll need to add everything about this resource
directory:
<project>
  ...
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>
</project>
With that, any resource file that contains ${pom.version} will replace
that text with the value from the version element of the pom.  The same
is true for other values in the pom.  I don't think values from
settings.xml are available, however.  Someone else can correct me if I'm
wrong.

..David..


-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Geoffrey
Sent: Wednesday, October 19, 2005 9:05 AM
To: users@maven.apache.org
Subject: [m2 & m1]Inject POM values into application

What is the best practice for injecting POM values into the application?
For example, I want my application to get it's version (in pom.xml),
releaseDate and productionMode (in settings.xml) variables feeded in the
build process.

In m1 I made a general resources template and I replaced tokens in it
and put a copy of that file in the target/classes after the resources
where copied. I did this in maven.xml of course.
Surely there must be a better way in maven 2?

Thanks for any and all help.

--
With kind regards,
Geoffrey De Smet


---------------------------------------------------------------------
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


Mime
View raw message