maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raf...@apache.org
Subject svn commit: r572059 - /maven/sandbox/trunk/archetypeng/archetype-creator/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
Date Sun, 02 Sep 2007 18:04:22 GMT
Author: rafale
Date: Sun Sep  2 11:04:21 2007
New Revision: 572059

URL: http://svn.apache.org/viewvc?rev=572059&view=rev
Log:
Added warning when defining properties that are pre-existant in project files when calling
create-from-project.
This close issue ARCHETYPE-90

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

Modified: maven/sandbox/trunk/archetypeng/archetype-creator/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-creator/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java?rev=572059&r1=572058&r2=572059&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-creator/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetype-creator/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
Sun Sep  2 11:04:21 2007
@@ -598,6 +598,20 @@
 
             pomManager.writePom ( pom, outputFile );
         }
+
+        String initialcontent = FileUtils.fileRead ( initialPomFile );
+        Iterator properties = pomReversedProperties.keySet ().iterator ();
+        while ( properties.hasNext () )
+        {
+            String property = (String) properties.next ();
+
+            if ( initialcontent.indexOf ( "${" + property + "}" ) > 0 )
+            {
+                getLogger ().warn ( "Archetype uses ${" + property +
+                    "} for internal processing, but file " + initialPomFile +
+                    " contains this property already");
+            }
+        }
     }
 
     private FileSet createFileSet (
@@ -848,6 +862,19 @@
             pomManager.writePom ( pom, outputFile );
         }
 
+        String initialcontent = FileUtils.fileRead ( initialPomFile );
+        Iterator properties = pomReversedProperties.keySet ().iterator ();
+        while ( properties.hasNext () )
+        {
+            String property = (String) properties.next ();
+
+            if (initialcontent.indexOf ( "${" + property + "}") > 0 )
+            {
+                getLogger ().warn ( "Archetype uses ${" + property +
+                    "} for internal processing, but file " + initialPomFile +
+                    " contains this property already");
+            }
+        }
     }
 
     private void createReplicaFiles ( List filesets, File basedir, File replicaFilesDirectory
)
@@ -1091,6 +1118,20 @@
                     fileEncoding
                 );
 //            String initialcontent = FileUtils.fileRead ( inputFile );
+
+            Iterator properties = reverseProperties.keySet ().iterator ();
+            while ( properties.hasNext () )
+            {
+                String property = (String) properties.next ();
+
+                if ( initialcontent.indexOf ( "${" + property + "}" ) > 0 )
+                {
+                    getLogger ().warn ( "Archetype uses ${" + property +
+                        "} for internal processing, but file " + inputFile +
+                        " contains this property already");
+                }
+            }
+
             String content = getReversedContent ( initialcontent, reverseProperties );
             outputFile.getParentFile ().mkdirs ();
             org.apache.commons.io.IOUtils.write (



Mime
View raw message