You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Al...@sungard.com on 2008/04/14 21:17:20 UTC

POM variables not expanded in resulting poms

I am trying to set the version of my projects using a property defined
on the maven command line. Please see below for examples.

 

The resulting .pom installed in the repository still contains the
reference to my variable 'productVersion'.

 

Should not the variable reference be expanded to its value?

 

Many thanks

Alessandro

 

 

 

[ sample command line option ]

 

mvn -DproductVersion=TEST install

 

[ sample pom ]

 

<project xmlns=http://maven.apache.org/POM/4.0.0

 

  ...

 

  <artifactId>com.sungard.common.utils</artifactId>

    <packaging>jar</packaging>

    <version>${productVersion}</version>

  <name>SunGard Common Utils</name> 

 

  ...

 

[ resulting pom installed in the repository as
com.sungard.common.utils-TEST.pom ]

 

 

<project xmlns=http://maven.apache.org/POM/4.0.0

 

  ...

 

  <artifactId>com.sungard.common.utils</artifactId>

    <packaging>jar</packaging>

    <version>${productVersion}</version>    <------------------- NOT
EXPANDED !!!!

  <name>SunGard Common Utils</name> 

 

  ...

 

 

 

 

 

 

 

 


RE: POM variables not expanded in resulting poms

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Using properties inside the groupId:artifactId:version of a pom or a
parent declaration will cause lots of problems. This is part of the
identity of that artifact and it's not able to be validated. If it works
at all it is probably by accident as I'm fairly sure this is not
supported.

-----Original Message-----
From: Salvador Diaz [mailto:sdiaz.externe@m6.fr] 
Sent: Tuesday, April 15, 2008 4:01 AM
To: Maven Users List
Subject: Re: POM variables not expanded in resulting poms

I noticed the very same thing and I also thought it was a bug because 
the eclipse plugin is unable to use such poms (with unexpanded 
variables) for artifact resolution. Running "mvn eclipse:eclipse" on a 
project inheriting one of those artifacts gives the following error:

[WARNING] POM for 
'myproject:com.mycompany.core:pom:0.21.0SNAPSHOT:compile' is invalid. It

will be ignored for artifact resolution. Reason: Failed to validate POM 
for project ${myproject.groupId}:com.mycompany.core at Artifact 
[myproject:com.mycompany.core:pom:0.21.0SNAPSHOT:compile]

Once this happens, one of the main advantages of maven is lost: 
transitive dependencies. Is it a bug or an expected behavior ? Is there 
something I'm missing here? Normally that variable should be resolved as

it is defined in one of the profiles defined in my settings.xml which is

always activated.

Brian E. Fox wrote:
> The properties are not expanded when sent to the repository because if
> they were then it would break inheritance when projects used that pom
> from the repo. There would no longer be any properties for people to
> inherit and override.
>
> -----Original Message-----
> From: Alessandro.Evangelista@sungard.com
> [mailto:Alessandro.Evangelista@sungard.com] 
> Sent: Monday, April 14, 2008 3:17 PM
> To: users@maven.apache.org
> Subject: POM variables not expanded in resulting poms
>
> I am trying to set the version of my projects using a property defined
> on the maven command line. Please see below for examples.
>
>  
>
> The resulting .pom installed in the repository still contains the
> reference to my variable 'productVersion'.
>
>  
>
> Should not the variable reference be expanded to its value?
>
>  
>
> Many thanks
>
> Alessandro
>
>  
>
>  
>
>  
>
> [ sample command line option ]
>
>  
>
> mvn -DproductVersion=TEST install
>
>  
>
> [ sample pom ]
>
>  
>
> <project xmlns=http://maven.apache.org/POM/4.0.0
>
>  
>
>   ...
>
>  
>
>   <artifactId>com.sungard.common.utils</artifactId>
>
>     <packaging>jar</packaging>
>
>     <version>${productVersion}</version>
>
>   <name>SunGard Common Utils</name> 
>
>  
>
>   ...
>
>  
>
> [ resulting pom installed in the repository as
> com.sungard.common.utils-TEST.pom ]
>
>  
>
>  
>
> <project xmlns=http://maven.apache.org/POM/4.0.0
>
>  
>
>   ...
>
>  
>
>   <artifactId>com.sungard.common.utils</artifactId>
>
>     <packaging>jar</packaging>
>
>     <version>${productVersion}</version>    <------------------- NOT
> EXPANDED !!!!
>
>   <name>SunGard Common Utils</name> 
>
>  
>
>   ...
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>
> ---------------------------------------------------------------------
> 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


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


RE: Executing a hook before reading a POM

Posted by "Libby, Cynthia" <Cy...@intuit.com>.
As far as replacing variables, are you talking about being able to use
environment variables - something like this:

<property name="FLEX_HOME" value="${env.FLEX_HOME}"/> 

Then use the property name throughout your pom.

Or am I completely missing your question? 


------------------------------------------------------- 
Cynthia Libby
Senior SCM Engineer 
5601 Headquarters Drive 
Plano, TX 75024-2262 
214-387-2573 
x72573

cynthia_libby@intuit.com


-----Original Message-----
From: fernando.cabrera@nordea.com [mailto:fernando.cabrera@nordea.com] 
Sent: Tuesday, April 15, 2008 4:12 AM
To: users@maven.apache.org
Subject: Executing a hook before reading a POM

Hi to all,

I am trying to find out how I can get maven to execute a hook before it
reads the POM file. But it seems that unless you go in and modify the
maven source code, at a user level, there is nothing to be done. I am
trying to execute the hook since maven doesn't replace variables within
the POM. And I need this information to be statically available within
our internal repositories.

1. Is there a "smart" way to get maven to execute hooks?

2. Am I a little far fetched for trying to implement a hook to do
something that Ant could do to pre-process the POM file?

Thanks in advance,
Fernando

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


RE: Executing a hook before reading a POM

Posted by Jörg Schaible <Jo...@Elsag-Solutions.com>.
Hi Joshua,

Joshua ChaitinPollak wrote:
> In this setup, you still need to refer to the version of the parent
> pom, right? 

Yes.

> We are just starting to use  multi-module pom, and are
> realizing that
> all of our modules are going to need to be updated with the parent-
> pom's version every time we release a new version. Is there any way
> around this? 

No, not really. Forget about all those recommendations to use properties for the version of the parent POM. This is not suppoerted and using properties for dependency versions is discouraged. Use a project (or company) wide POM to define the versions of your dependencies in a dependencyManagement section. Then you don't have to set any version for the deps in your POMs. To refer the global parent POM you might use simply "SNAPSHOT" as version for that. Each time you like to release the artifact, you will have to replace it with the latest release of the global POM. You may immediately return to SNAPSHOT after the release then or keep the version number of the released parent until you need a dependency with a newer version. With this approach all artifacts that refer the global POM as SNAPSHOT don't have to be changed if you have to release the global POM (using "SNAPSHOT" as the next development version).

- Jörg

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


RE: Executing a hook before reading a POM

Posted by Bernhard David <da...@elca.ch>.
It appears my attachment didn't work. So here's the script once again: 



#!/bin/bash -e

#* %box% Go through all the pom.xml and set the version number (if
present). E.g. =1.1.1-SNAPSHOT= -> =1.1.1= and correct the version of
the parent.
#   * %box% Update the version of all modules to indicate that they
changed.
#      * Remove the =-SNAPSHOT= for modules and plugins that weren't
changed. E.g. 1.6-SNAPSHOT -> 1.6

# make sure you are in right folder
if ! [ -e external ] ; then
	echo "Error: Folder 'external' not found. Go to its parent
folder (el4j)!"
	exit
fi

echo "Update framework (external and internal)"
el4jCurrent=$(cat external/pom.xml | grep
"<version.el4j-framework.current>" -A 1 | tail -n 1 | tr -d ' \t\r\n' |
sed 's/-SNAPSHOT//')
echo "Current version is $el4jCurrent-SNAPSHOT, OK?"
read dummy
echo "Enter next el4j version number"
read el4jNext

el4jCurrent=$el4jCurrent-SNAPSHOT

echo "Replacing '$el4jCurrent' by '$el4jNext', OK?"
read dummy

echo "Searching for pom.xml files..."


# list pom files
find ./ -name "pom.xml" > pom.files.txt
find ./ -name "site.xml" >> pom.files.txt

################################
# el4j x.y-SNAPSHOT -> x.y #
################################
for i in $(cat pom.files.txt) ; do
	if [ $(grep -c "<version>$el4jCurrent</version>" $i) -eq 1 ] ;
then
		cat $i | sed "s/$el4jCurrent/$el4jNext/" > $i.new
		mv $i.new $i
		echo "FOUND $i"
	else
		echo "----- $i"
	fi
done

##################################
# el4j modules: remove -SNAPSHOT #
##################################
search="external/pom.xml"
if [ -e internal ] ; then
	search="$search internal/pom.xml"
fi
for i in $search ; do
	cat $i | sed "s/-SNAPSHOT$//" > $i.new
	mv $i.new $i
done

echo ""
echo
"#######################################################################
######################"
echo "#Work is not finished yet! Search in all pom.xml and site.xml
files for the String SNAPSHOT.#"
echo "#It's also a good practice to go through the changes this script
made (use svn diff).       #"
echo
"#######################################################################
######################"
echo ""

echo "Searching for SNAPSHOT:"
cat pom.files.txt | xargs grep "SNAPSHOT"

echo ""
echo "Correct these files manually if necessary!"
rm pom.files.txt

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


RE: Executing a hook before reading a POM

Posted by Bernhard David <da...@elca.ch>.
Hello,

yes, you're right there - you could, as Cynthia mentioned, use ${env.parentversion} and pass the env variable on the command line or set it as an environment variable in the system.

What we do is use a shell script to update the versions every time we make a new release - I'll send it as attachment.

 
David



> -----Original Message-----
> From: Joshua ChaitinPollak [mailto:jpollak@kivasystems.com] 
> Sent: 15 April 2008 19:22
> To: Maven Users List
> Subject: Re: Executing a hook before reading a POM
> 
> In this setup, you still need to refer to the version of the parent  
> pom, right?
> 
> We are just starting to use  multi-module pom, and are 
> realizing that  
> all of our modules are going to need to be updated with the parent- 
> pom's version every time we release a new version. Is there any way  
> around this?
> 
> 
> On Apr 15, 2008, at 7:22 AM, Bernhard David wrote:
> 
> > Hi,
> >
> > what we do is declare all global constants (version numbers 
> etc.) in  
> > one parent pom like this:
> >
> > <properties>
> > 	<version.moudule-xxx>1.0</version.module-xxx>
> > </properties>
> >
> > then in the modules' pom declare it (or a descendent of it) as  
> > <parent>. Then you can just write
> >
> > <artifactId>module-xxx</artifactId>
> > <version>${version.module-xxx}</version>
> >
> > in the actual module pom.
> >
> > Maybe that will help solve your problem.
> >
> > Regards,
> >
> > David
> >
> >> -----Original Message-----
> >> From: VUB Stefan Seidel [mailto:sseidel@vub.de]
> >> Sent: 15 April 2008 12:30
> >> To: Maven Users List
> >> Subject: Re: Executing a hook before reading a POM
> >>
> >> Hi,
> >>
> >> use
> >>   <properties>
> >>     <myProperty>myValue</myProperty>
> >>   </properties>
> >> if you want to set fixed properties for the build process.
> >>
> >> You may also want to have a look at how to use profiles.
> >>
> >> regards,
> >>
> >> Stefan
> >>
> >> fernando.cabrera@nordea.com wrote:
> >>> Hi to all,
> >>>
> >>> I am trying to find out how I can get maven to execute a
> >> hook before it reads the POM file. But it seems that unless
> >> you go in and modify the maven source code, at a user level,
> >> there is nothing to be done. I am trying to execute the hook
> >> since maven doesn't replace variables within the POM. And I
> >> need this information to be statically available within our
> >> internal repositories.
> >>>
> >>> 1. Is there a "smart" way to get maven to execute hooks?
> >>>
> >>> 2. Am I a little far fetched for trying to implement a hook
> >> to do something that Ant could do to pre-process the POM file?
> >>>
> >>> Thanks in advance,
> >>> Fernando
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>
> >> -- 
> >> best regards,
> >>
> >> Stefan Seidel
> >> software developer
> >> ________________________
> >> VUB Printmedia GmbH
> >> Chopinstra�e 4
> >> D-04103 Leipzig
> >> Germany
> >> tel.    +49 (341) 9 60 50 07
> >> fax.    +49 (341) 9 60 50 92
> >> mail.   sseidel@vub.de
> >> web.    www.vub.de
> >>
> >> HRB K�ln 24015
> >> UStID DE 122 649 251
> >> GF Dr. Achim Preuss Neudorf,
> >> Dr. Christian Preuss Neudorf
> >>
> >> 
> ---------------------------------------------------------------------
> >> 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
> >
> >
> 
> -- 
> Joshua ChaitinPollak | Software Engineer
> Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970
> 
> 
> 
> 
> 
> 
> 


RE: Executing a hook before reading a POM

Posted by "Beelen, M. - SPLXL" <Ma...@klm.com>.
Hi,

The proper way around this is: Use the release-plugin.

When you execute mvn release:prepare and mvn release:perform all the version-number in the parent-element of all modules get updated automatically.

Within the pom of the child-modules you remove the version-tag of the project, since all child-modules will inherit the version for the parent in a multi-module-project.

With kind regards,
  Marco Beelen
 

-----Original Message-----
From: Joshua ChaitinPollak [mailto:jpollak@kivasystems.com] 
Sent: Tuesday, April 15, 2008 7:22 PM
To: Maven Users List
Subject: Re: Executing a hook before reading a POM

In this setup, you still need to refer to the version of the parent pom, right?

We are just starting to use  multi-module pom, and are realizing that all of our modules are going to need to be updated with the parent- pom's version every time we release a new version. Is there any way around this?


On Apr 15, 2008, at 7:22 AM, Bernhard David wrote:

> Hi,
>
> what we do is declare all global constants (version numbers etc.) in 
> one parent pom like this:
>
> <properties>
> 	<version.moudule-xxx>1.0</version.module-xxx>
> </properties>
>
> then in the modules' pom declare it (or a descendent of it) as 
> <parent>. Then you can just write
>
> <artifactId>module-xxx</artifactId>
> <version>${version.module-xxx}</version>
>
> in the actual module pom.
>
> Maybe that will help solve your problem.
>
> Regards,
>
> David
>
>> -----Original Message-----
>> From: VUB Stefan Seidel [mailto:sseidel@vub.de]
>> Sent: 15 April 2008 12:30
>> To: Maven Users List
>> Subject: Re: Executing a hook before reading a POM
>>
>> Hi,
>>
>> use
>>   <properties>
>>     <myProperty>myValue</myProperty>
>>   </properties>
>> if you want to set fixed properties for the build process.
>>
>> You may also want to have a look at how to use profiles.
>>
>> regards,
>>
>> Stefan
>>
>> fernando.cabrera@nordea.com wrote:
>>> Hi to all,
>>>
>>> I am trying to find out how I can get maven to execute a
>> hook before it reads the POM file. But it seems that unless you go in 
>> and modify the maven source code, at a user level, there is nothing 
>> to be done. I am trying to execute the hook since maven doesn't 
>> replace variables within the POM. And I need this information to be 
>> statically available within our internal repositories.
>>>
>>> 1. Is there a "smart" way to get maven to execute hooks?
>>>
>>> 2. Am I a little far fetched for trying to implement a hook
>> to do something that Ant could do to pre-process the POM file?
>>>
>>> Thanks in advance,
>>> Fernando
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> --
>> best regards,
>>
>> Stefan Seidel
>> software developer
>> ________________________
>> VUB Printmedia GmbH
>> Chopinstraße 4
>> D-04103 Leipzig
>> Germany
>> tel.    +49 (341) 9 60 50 07
>> fax.    +49 (341) 9 60 50 92
>> mail.   sseidel@vub.de
>> web.    www.vub.de
>>
>> HRB Köln 24015
>> UStID DE 122 649 251
>> GF Dr. Achim Preuss Neudorf,
>> Dr. Christian Preuss Neudorf
>>
>> ---------------------------------------------------------------------
>> 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
>
>

--
Joshua ChaitinPollak | Software Engineer Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970






**********************************************************************
For information, services and offers, please visit our web site:
http://www.klm.com. This e-mail and any attachment may contain
confidential and privileged material intended for the addressee
only. If you are not the addressee, you are notified that no part
of the e-mail or any attachment may be disclosed, copied or
distributed, and that any other action related to this e-mail or
attachment is strictly prohibited, and may be unlawful. If you have
received this e-mail by error, please notify the sender immediately
by return e-mail, and delete this message. 

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries
and/or its employees shall not be liable for the incorrect or
incomplete transmission of this e-mail or any attachments, nor
responsible for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal
Dutch Airlines) is registered in Amstelveen, The Netherlands, with
registered number 33014286 
**********************************************************************

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


Re: Executing a hook before reading a POM

Posted by Joshua ChaitinPollak <jp...@kivasystems.com>.
In this setup, you still need to refer to the version of the parent  
pom, right?

We are just starting to use  multi-module pom, and are realizing that  
all of our modules are going to need to be updated with the parent- 
pom's version every time we release a new version. Is there any way  
around this?


On Apr 15, 2008, at 7:22 AM, Bernhard David wrote:

> Hi,
>
> what we do is declare all global constants (version numbers etc.) in  
> one parent pom like this:
>
> <properties>
> 	<version.moudule-xxx>1.0</version.module-xxx>
> </properties>
>
> then in the modules' pom declare it (or a descendent of it) as  
> <parent>. Then you can just write
>
> <artifactId>module-xxx</artifactId>
> <version>${version.module-xxx}</version>
>
> in the actual module pom.
>
> Maybe that will help solve your problem.
>
> Regards,
>
> David
>
>> -----Original Message-----
>> From: VUB Stefan Seidel [mailto:sseidel@vub.de]
>> Sent: 15 April 2008 12:30
>> To: Maven Users List
>> Subject: Re: Executing a hook before reading a POM
>>
>> Hi,
>>
>> use
>>   <properties>
>>     <myProperty>myValue</myProperty>
>>   </properties>
>> if you want to set fixed properties for the build process.
>>
>> You may also want to have a look at how to use profiles.
>>
>> regards,
>>
>> Stefan
>>
>> fernando.cabrera@nordea.com wrote:
>>> Hi to all,
>>>
>>> I am trying to find out how I can get maven to execute a
>> hook before it reads the POM file. But it seems that unless
>> you go in and modify the maven source code, at a user level,
>> there is nothing to be done. I am trying to execute the hook
>> since maven doesn't replace variables within the POM. And I
>> need this information to be statically available within our
>> internal repositories.
>>>
>>> 1. Is there a "smart" way to get maven to execute hooks?
>>>
>>> 2. Am I a little far fetched for trying to implement a hook
>> to do something that Ant could do to pre-process the POM file?
>>>
>>> Thanks in advance,
>>> Fernando
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> -- 
>> best regards,
>>
>> Stefan Seidel
>> software developer
>> ________________________
>> VUB Printmedia GmbH
>> Chopinstraße 4
>> D-04103 Leipzig
>> Germany
>> tel.    +49 (341) 9 60 50 07
>> fax.    +49 (341) 9 60 50 92
>> mail.   sseidel@vub.de
>> web.    www.vub.de
>>
>> HRB Köln 24015
>> UStID DE 122 649 251
>> GF Dr. Achim Preuss Neudorf,
>> Dr. Christian Preuss Neudorf
>>
>> ---------------------------------------------------------------------
>> 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
>
>

-- 
Joshua ChaitinPollak | Software Engineer
Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970







RE: Executing a hook before reading a POM

Posted by Bernhard David <da...@elca.ch>.
Hi,

what we do is declare all global constants (version numbers etc.) in one parent pom like this:

<properties>
	<version.moudule-xxx>1.0</version.module-xxx>
</properties> 

then in the modules' pom declare it (or a descendent of it) as <parent>. Then you can just write

<artifactId>module-xxx</artifactId>
<version>${version.module-xxx}</version>

in the actual module pom.

Maybe that will help solve your problem.

Regards,

David 

> -----Original Message-----
> From: VUB Stefan Seidel [mailto:sseidel@vub.de] 
> Sent: 15 April 2008 12:30
> To: Maven Users List
> Subject: Re: Executing a hook before reading a POM
> 
> Hi,
> 
> use
>    <properties>
>      <myProperty>myValue</myProperty>
>    </properties>
> if you want to set fixed properties for the build process.
> 
> You may also want to have a look at how to use profiles.
> 
> regards,
> 
> Stefan
> 
> fernando.cabrera@nordea.com wrote:
> > Hi to all,
> > 
> > I am trying to find out how I can get maven to execute a 
> hook before it reads the POM file. But it seems that unless 
> you go in and modify the maven source code, at a user level, 
> there is nothing to be done. I am trying to execute the hook 
> since maven doesn't replace variables within the POM. And I 
> need this information to be statically available within our 
> internal repositories.
> > 
> > 1. Is there a "smart" way to get maven to execute hooks?
> > 
> > 2. Am I a little far fetched for trying to implement a hook 
> to do something that Ant could do to pre-process the POM file?
> > 
> > Thanks in advance,
> > Fernando
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> 
> -- 
> best regards,
> 
> Stefan Seidel
> software developer
> ________________________
> VUB Printmedia GmbH
> Chopinstraße 4
> D-04103 Leipzig
> Germany
> tel.    +49 (341) 9 60 50 07
> fax.    +49 (341) 9 60 50 92
> mail.   sseidel@vub.de
> web.    www.vub.de
> 
> HRB Köln 24015
> UStID DE 122 649 251
> GF Dr. Achim Preuss Neudorf,
> Dr. Christian Preuss Neudorf
> 
> ---------------------------------------------------------------------
> 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


Re: Executing a hook before reading a POM

Posted by VUB Stefan Seidel <ss...@vub.de>.
Hi,

use
   <properties>
     <myProperty>myValue</myProperty>
   </properties>
if you want to set fixed properties for the build process.

You may also want to have a look at how to use profiles.

regards,

Stefan

fernando.cabrera@nordea.com wrote:
> Hi to all,
> 
> I am trying to find out how I can get maven to execute a hook before it reads the POM file. But it seems that unless you go in and modify the maven source code, at a user level, there is nothing to be done. I am trying to execute the hook since maven doesn't replace variables within the POM. And I need this information to be statically available within our internal repositories.
> 
> 1. Is there a "smart" way to get maven to execute hooks?
> 
> 2. Am I a little far fetched for trying to implement a hook to do something that Ant could do to pre-process the POM file?
> 
> Thanks in advance,
> Fernando
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-- 
best regards,

Stefan Seidel
software developer
________________________
VUB Printmedia GmbH
Chopinstraße 4
D-04103 Leipzig
Germany
tel.    +49 (341) 9 60 50 07
fax.    +49 (341) 9 60 50 92
mail.   sseidel@vub.de
web.    www.vub.de

HRB Köln 24015
UStID DE 122 649 251
GF Dr. Achim Preuss Neudorf,
Dr. Christian Preuss Neudorf

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


Executing a hook before reading a POM

Posted by fe...@nordea.com.
Hi to all,

I am trying to find out how I can get maven to execute a hook before it reads the POM file. But it seems that unless you go in and modify the maven source code, at a user level, there is nothing to be done. I am trying to execute the hook since maven doesn't replace variables within the POM. And I need this information to be statically available within our internal repositories.

1. Is there a "smart" way to get maven to execute hooks?

2. Am I a little far fetched for trying to implement a hook to do something that Ant could do to pre-process the POM file?

Thanks in advance,
Fernando

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


Re: POM variables not expanded in resulting poms

Posted by Salvador Diaz <sd...@m6.fr>.
I noticed the very same thing and I also thought it was a bug because 
the eclipse plugin is unable to use such poms (with unexpanded 
variables) for artifact resolution. Running "mvn eclipse:eclipse" on a 
project inheriting one of those artifacts gives the following error:

[WARNING] POM for 
'myproject:com.mycompany.core:pom:0.21.0SNAPSHOT:compile' is invalid. It 
will be ignored for artifact resolution. Reason: Failed to validate POM 
for project ${myproject.groupId}:com.mycompany.core at Artifact 
[myproject:com.mycompany.core:pom:0.21.0SNAPSHOT:compile]

Once this happens, one of the main advantages of maven is lost: 
transitive dependencies. Is it a bug or an expected behavior ? Is there 
something I'm missing here? Normally that variable should be resolved as 
it is defined in one of the profiles defined in my settings.xml which is 
always activated.

Brian E. Fox wrote:
> The properties are not expanded when sent to the repository because if
> they were then it would break inheritance when projects used that pom
> from the repo. There would no longer be any properties for people to
> inherit and override.
>
> -----Original Message-----
> From: Alessandro.Evangelista@sungard.com
> [mailto:Alessandro.Evangelista@sungard.com] 
> Sent: Monday, April 14, 2008 3:17 PM
> To: users@maven.apache.org
> Subject: POM variables not expanded in resulting poms
>
> I am trying to set the version of my projects using a property defined
> on the maven command line. Please see below for examples.
>
>  
>
> The resulting .pom installed in the repository still contains the
> reference to my variable 'productVersion'.
>
>  
>
> Should not the variable reference be expanded to its value?
>
>  
>
> Many thanks
>
> Alessandro
>
>  
>
>  
>
>  
>
> [ sample command line option ]
>
>  
>
> mvn -DproductVersion=TEST install
>
>  
>
> [ sample pom ]
>
>  
>
> <project xmlns=http://maven.apache.org/POM/4.0.0
>
>  
>
>   ...
>
>  
>
>   <artifactId>com.sungard.common.utils</artifactId>
>
>     <packaging>jar</packaging>
>
>     <version>${productVersion}</version>
>
>   <name>SunGard Common Utils</name> 
>
>  
>
>   ...
>
>  
>
> [ resulting pom installed in the repository as
> com.sungard.common.utils-TEST.pom ]
>
>  
>
>  
>
> <project xmlns=http://maven.apache.org/POM/4.0.0
>
>  
>
>   ...
>
>  
>
>   <artifactId>com.sungard.common.utils</artifactId>
>
>     <packaging>jar</packaging>
>
>     <version>${productVersion}</version>    <------------------- NOT
> EXPANDED !!!!
>
>   <name>SunGard Common Utils</name> 
>
>  
>
>   ...
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>
> ---------------------------------------------------------------------
> 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


RE: POM variables not expanded in resulting poms

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
The properties are not expanded when sent to the repository because if
they were then it would break inheritance when projects used that pom
from the repo. There would no longer be any properties for people to
inherit and override.

-----Original Message-----
From: Alessandro.Evangelista@sungard.com
[mailto:Alessandro.Evangelista@sungard.com] 
Sent: Monday, April 14, 2008 3:17 PM
To: users@maven.apache.org
Subject: POM variables not expanded in resulting poms

I am trying to set the version of my projects using a property defined
on the maven command line. Please see below for examples.

 

The resulting .pom installed in the repository still contains the
reference to my variable 'productVersion'.

 

Should not the variable reference be expanded to its value?

 

Many thanks

Alessandro

 

 

 

[ sample command line option ]

 

mvn -DproductVersion=TEST install

 

[ sample pom ]

 

<project xmlns=http://maven.apache.org/POM/4.0.0

 

  ...

 

  <artifactId>com.sungard.common.utils</artifactId>

    <packaging>jar</packaging>

    <version>${productVersion}</version>

  <name>SunGard Common Utils</name> 

 

  ...

 

[ resulting pom installed in the repository as
com.sungard.common.utils-TEST.pom ]

 

 

<project xmlns=http://maven.apache.org/POM/4.0.0

 

  ...

 

  <artifactId>com.sungard.common.utils</artifactId>

    <packaging>jar</packaging>

    <version>${productVersion}</version>    <------------------- NOT
EXPANDED !!!!

  <name>SunGard Common Utils</name> 

 

  ...

 

 

 

 

 

 

 

 


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