maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1073565 - /maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
Date Wed, 23 Feb 2011 00:48:40 GMT
Author: hboutemy
Date: Wed Feb 23 00:48:40 2011
New Revision: 1073565

URL: http://svn.apache.org/viewvc?rev=1073565&view=rev
Log:
[ARCHETYPE-339] fixed ${package} use preferred to ${packageInPathFormat} when they have the
same value

Modified:
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java?rev=1073565&r1=1073564&r2=1073565&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
Wed Feb 23 00:48:40 2011
@@ -153,11 +153,11 @@ public class FilesetArchetypeCreator
             addRequiredProperties( archetypeDescriptor, properties );
 
             // TODO ensure reverseProperties contains NO dotted properties
-            Properties reverseProperties = getRequiredProperties( archetypeDescriptor, properties
);
+            Properties reverseProperties = getReversedProperties( archetypeDescriptor, properties
);
             // reverseProperties.remove( Constants.GROUP_ID );
 
             // TODO ensure pomReversedProperties contains NO dotted properties
-            Properties pomReversedProperties = getRequiredProperties( archetypeDescriptor,
properties );
+            Properties pomReversedProperties = getReversedProperties( archetypeDescriptor,
properties );
             // pomReversedProperties.remove( Constants.PACKAGE );
 
             String packageName = configurationProperties.getProperty( Constants.PACKAGE );
@@ -1337,7 +1337,7 @@ public class FilesetArchetypeCreator
         return unpackagedSources;
     }
 
-    private Properties getRequiredProperties( ArchetypeDescriptor archetypeDescriptor, Properties
properties )
+    private Properties getReversedProperties( ArchetypeDescriptor archetypeDescriptor, Properties
properties )
     {
         Properties reversedProperties = new Properties();
 
@@ -1345,8 +1345,16 @@ public class FilesetArchetypeCreator
         reversedProperties.remove( Constants.ARCHETYPE_GROUP_ID );
         reversedProperties.remove( Constants.ARCHETYPE_ARTIFACT_ID );
         reversedProperties.remove( Constants.ARCHETYPE_VERSION );
-        reversedProperties.setProperty( Constants.PACKAGE_IN_PATH_FORMAT,
-                                        getPackageInPathFormat( properties.getProperty( Constants.PACKAGE
) ) );
+
+        String packageName = properties.getProperty( Constants.PACKAGE );
+        String packageInPathFormat = getPackageInPathFormat( packageName );
+        if ( !packageInPathFormat.equals( packageName ) )
+        {
+            reversedProperties.setProperty( Constants.PACKAGE_IN_PATH_FORMAT, packageInPathFormat
);
+        }
+
+        // TODO check that reversed properties are all different and no one is a substring
of another?
+        // to avoid wrong variable replacements
 
         return reversedProperties;
     }



Mime
View raw message