Yes, that would work. The problem is that the release plugin will not update
that property, so
we get a manual step when doing a release.
Peter
Andrew Williams-5 wrote:
>
> Not entirely certain if this will help or not, but could you define a
> property and reference that instead?
>
> i.e.
> <property>
> <myversion>1.0-SNAPSHOT</myversion>
> </property>
>
> then using ${myversion} will always return you that version
>
> Andy
>
> On 4 Sep 2007, at 08:42, PeterNilsson wrote:
>
>>
>> Hi,
>>
>> Sorry for being unclear.
>> What I need is a way to in the parentpom access the version of the
>> parent
>> pom regardless of where the builld was started from.
>>
>> In your example I want to write something in pom.xml (not my-module/
>> pom.xml)
>> that when the build is run from either parent, child or grandchild
>> will
>> output 1.0-SNAPSHOT.
>>
>> Peter
>>
>>
>> Thorsten Heit-3 wrote:
>>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hi,
>>>
>>>> Won't ${project.version} be resolved to the version of the pom in
>>>> the
>>>> project
>>>> where the build was invoked?
>>>
>>> No. "${project.version}" in the child indeed contains the child's
>>> version, not the one from the parent. Try this:
>>>
>>>
>>> Parent:
>>>
>>> <project>
>>> <modelVersion>4.0.0</modelVersion>
>>> <groupId>com.mycompany.app</groupId>
>>> <artifactId>my-app</artifactId>
>>> <packaging>pom</packaging>
>>> <version>1.0-SNAPSHOT</version>
>>> <name>my-app</name>
>>>
>>> <modules>
>>> <module>my-module</module>
>>> </modules>
>>> </project>
>>>
>>>
>>> Child (my-module/pom.xml):
>>>
>>> <project>
>>> <modelVersion>4.0.0</modelVersion>
>>> <groupId>com.mycompany.app</groupId>
>>> <artifactId>my-app-test</artifactId>
>>> <packaging>jar</packaging>
>>> <version>2.0-SNAPSHOT</version>
>>> <name>my-app</name>
>>>
>>> <parent>
>>> <groupId>com.mycompany.app</groupId>
>>> <artifactId>my-app</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </parent>
>>>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-antrun-plugin</artifactId>
>>> <executions>
>>> <execution>
>>> <phase>generate-sources</phase>
>>> <configuration>
>>> <tasks>
>>> <echo message="project.version: $
>>> {project.version}" />
>>> </tasks>
>>> </configuration>
>>> <goals>
>>> <goal>run</goal>
>>> </goals>
>>> </execution>
>>> </executions>
>>> </plugin>
>>> </plugins>
>>> </build>
>>> </project>
>>>
>>>
>>> "mvn compile" outputs
>>>
>>> (...)
>>> [INFO] Building my-app
>>> [INFO] task-segment: [compile]
>>> [INFO]
>>> -
>>> ---------------------------------------------------------------------
>>> -------
>>> [INFO] [antrun:run {execution: default}]
>>> [INFO] Executing tasks
>>> [echo] project.version: 2.0-SNAPSHOT
>>> [INFO] Executed tasks
>>> [INFO] [resources:resources]
>>> (...)
>>>
>>>
>>> Regards
>>>
>>> Thorsten
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.6 (Darwin)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iEYEARECAAYFAkbccHkACgkQQvObkgCcDe3rWwCfeMXwqYi4Ouue0RuYmPxi1tNr
>>> dIkAn35t6lya0ChFVKiFnYsD76Cb9Dpc
>>> =47pS
>>> -----END PGP SIGNATURE-----
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Retrieving-
>> version-of-the-pom-itself---not-the-child-projects-pom-
>> tf4359342s177.html#a12473366
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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]
>
>
>
--
View this message in context:
http://www.nabble.com/Retrieving-version-of-the-pom-itself---not-the-child-projects-pom-tf4359342s177.html#a12499244
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]