Re: [m2 & m1]Inject POM values into application

2005-10-21 Thread Brett Porter
You can most likely do this with property activated profiles.

On 10/20/05, Geoffrey <[EMAIL PROTECTED]> wrote:
> There is even second use case besides the releaseDate that the filtering
> can't cut:
>
> Depending on a variable, for example
> release.database = mysql
> Certain hibernate properties should be set, such as the hibernate
> dialect and the jdbc url, depending on a condition based on the
> release.database value.
>
> With kind regards,
> Geoffrey
>
> Vincent Massol wrote:
> >
> >>-Original Message-
> >>From: David Jackman [mailto:[EMAIL PROTECTED]
> >>Sent: mercredi 19 octobre 2005 18:37
> >>To: Maven Users List
> >>Subject: RE: [m2 & m1]Inject POM values into application
> >>
> >>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:
> >>
> >>  ...
> >>  
> >>
> >>  
> >>src/main/resources
> >>true
> >>  
> >>
> >>  
> >>
> >>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.
> >
> >
> > Agreed, this would solve one use case.
> >
> > However imagine the case where you have a SNAPSHOT version. When you release
> > something you want that version to be resolved to a timestamp. Thus if
> > you're putting this version on say a web page (hint: continuum's web page)
> > you'd like to see the resolved timestamp value and not the SNAPSHOT.
> >
> > Any idea how to do this?
> >
> > Thanks
> > -Vincent
>
> --
> With kind regards,
> Geoffrey De Smet
>
>
> -
> 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]



Re: [m2 & m1]Inject POM values into application

2005-10-21 Thread Brett Porter
I think there is an open bug for including the information in the
manifest - the same solution would be required to enable this.

- Brett

On 10/19/05, Vincent Massol <[EMAIL PROTECTED]> wrote:
>
>
> > -Original Message-
> > From: David Jackman [mailto:[EMAIL PROTECTED]
> > Sent: mercredi 19 octobre 2005 18:37
> > To: Maven Users List
> > Subject: RE: [m2 & m1]Inject POM values into application
> >
> > 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:
> > 
> >   ...
> >   
> > 
> >   
> > src/main/resources
> > true
> >   
> > 
> >   
> > 
> > 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.
>
> Agreed, this would solve one use case.
>
> However imagine the case where you have a SNAPSHOT version. When you release
> something you want that version to be resolved to a timestamp. Thus if
> you're putting this version on say a web page (hint: continuum's web page)
> you'd like to see the resolved timestamp value and not the SNAPSHOT.
>
> Any idea how to do this?
>
> Thanks
> -Vincent
>
>
> -
> 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]



Re: [m2 & m1]Inject POM values into application

2005-10-20 Thread Geoffrey
There is even second use case besides the releaseDate that the filtering 
can't cut:


Depending on a variable, for example
release.database = mysql
Certain hibernate properties should be set, such as the hibernate 
dialect and the jdbc url, depending on a condition based on the 
release.database value.


With kind regards,
Geoffrey

Vincent Massol wrote:



-Original Message-
From: David Jackman [mailto:[EMAIL PROTECTED]
Sent: mercredi 19 octobre 2005 18:37
To: Maven Users List
Subject: RE: [m2 & m1]Inject POM values into application

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:

 ...
 
   
 
   src/main/resources
   true
 
   
 

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.



Agreed, this would solve one use case.

However imagine the case where you have a SNAPSHOT version. When you release
something you want that version to be resolved to a timestamp. Thus if
you're putting this version on say a web page (hint: continuum's web page)
you'd like to see the resolved timestamp value and not the SNAPSHOT.

Any idea how to do this?

Thanks
-Vincent


--
With kind regards,
Geoffrey De Smet


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



RE: [m2 & m1]Inject POM values into application

2005-10-19 Thread Vincent Massol


> -Original Message-
> From: David Jackman [mailto:[EMAIL PROTECTED]
> Sent: mercredi 19 octobre 2005 18:37
> To: Maven Users List
> Subject: RE: [m2 & m1]Inject POM values into application
> 
> 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:
> 
>   ...
>   
> 
>   
> src/main/resources
> true
>   
> 
>   
> 
> 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.

Agreed, this would solve one use case.

However imagine the case where you have a SNAPSHOT version. When you release
something you want that version to be resolved to a timestamp. Thus if
you're putting this version on say a web page (hint: continuum's web page)
you'd like to see the resolved timestamp value and not the SNAPSHOT.

Any idea how to do this?

Thanks
-Vincent


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



RE: [m2 & m1]Inject POM values into application

2005-10-19 Thread David Jackman
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:

  ...
  

  
src/main/resources
true
  

  

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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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



[m2 & m1]Inject POM values into application

2005-10-19 Thread Geoffrey

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]