You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Harsha Rai (JIRA)" <ji...@codehaus.org> on 2008/08/21 01:34:26 UTC
[jira] Issue Comment Edited: (MNG-3057) properties not expanded in
generated POMs when building A/B/C nested projects
[ http://jira.codehaus.org/browse/MNG-3057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=145614#action_145614 ]
hg2008 edited comment on MNG-3057 at 8/20/08 6:33 PM:
----------------------------------------------------------
Hello:
The above patch does not work, if the global-version property is defined outside pom.xml or outside settings.xml . In other words, if you define like :
$ mvn install -Dglobal-version=1.0.0
in maven 2.0.9 it does not reflect the property "global-version" into the project properties (another existing bug against maven).
Hence, the generated pom still will have stale ${global-version} as value.
As you can guess obviously, one need to add a few lines of code to fix the bug. Check property against System.getProperty(key) to see if there is a global property defined from command line...
Here is a partial diff:
+ while (m.find()) {
+ String match = m.group();
+ String key = match.substring(2, match.length()-1);
+ String value = properties.getProperty(key);
+ if (value == null) {
+ System.out.println("Trying .. system wide property..");
+ value = System.getProperty(key);
+ if (value !=null)
+ System.out.println("Found value from sys=" + value);
+ }
+ if (value != null) {
+ s = s.replaceAll("\\$\\{" + key + "\\}", value);
+ }
was (Author: hg2008):
Hello:
The above patch does not work, if the global-version property is defined outside pom.xml or outside settings.xml . In other words, if you define like :
$ mvn install -Dglobal-version=1.0.0
in maven 2.0.9 it does not reflect the property "global-version" into the project properties (another existing bug against maven).
Hence, the generated pom still will have stale ${global-version} as value.
As you can guess obviously, one need to add a few lines of code to fix the bug. Check property against System.getProperty(key) to see if there is a global property defined from command line...
Here is a partial diff:
+ while (m.find()) {
+ String match = m.group();
+ String key = match.substring(2, match.length()-1);
+ String value = properties.getProperty(key);
+ if (value == null) {
+ System.out.println("Trying .. system wide property..");
+ value = System.getProperty(key);
+ if (value !=null)
+ System.out.println("Found value from sys=" + value);
+ }
+ if (value != null) {
+ s = s.replaceAll("\\$\\{" + key + "\\}", value);
+ }
> properties not expanded in generated POMs when building A/B/C nested projects
> -----------------------------------------------------------------------------
>
> Key: MNG-3057
> URL: http://jira.codehaus.org/browse/MNG-3057
> Project: Maven 2
> Issue Type: Bug
> Components: Inheritance and Interpolation
> Affects Versions: 2.0.7
> Reporter: George Armhold
> Fix For: 2.0.x
>
> Attachments: example.tar.gz, generated-poms.tar.gz, InstallMojo.java.patch
>
>
> Using Maven version: 2.0.8-SNAPSHOT, svn r547427.
> I checked out and built 2.0.8 because I was interested in Jason van Zyl's patch for MNG-2619- "building from the middle pom of a (parent,child,grandchild) heirarchy fails". The fix works for the most part, but there still seems to be a problem with the poms that get generated during the install goal. The poms that get installed into .m2/repository do not have properties interpolated. If I run maven like:
> $ mvn install -Dglobal-version=1.0.0
> I get poms with the string "${global-version}" embedded in the resulting poms rather than what I specify on the command line (or in settings.xml). The build works properly aside from this, and if I do "mvn help:effective-pom" the properties are correctly interpolated.
> I've attached a tarfile with an example A/B/C build structure that exhibits this behavior, as well as the generated poms.
> Many thanks for your attention.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira