You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Wolfgang Knauf (Jira)" <ji...@apache.org> on 2023/10/05 15:36:00 UTC

[jira] [Commented] (ARCHETYPE-649) "[WARNING] CP Don't override file" when generating archetype with 3.2.1

    [ https://issues.apache.org/jira/browse/ARCHETYPE-649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17772261#comment-17772261 ] 

Wolfgang Knauf commented on ARCHETYPE-649:
------------------------------------------

Here is the slighly simplified source project, which reproduces the problem:

[^wildfly-jakartaee-ear-archetype_ARCHETYPE-649.zip]

 

In "pom.xml", there is a section where the archetype-plugin version can be defined:

{{        <pluginManagement>}}
{{            <plugins>}}
{{                <plugin>}}
{{                    <groupId>org.apache.maven.plugins</groupId>}}
{{                    <artifactId>maven-archetype-plugin</artifactId>}}
{{                    <version>3.2.1</version>}}
{{                    <!--<version>3.1.2</version>-->}}
{{                    <extensions>true</extensions>}}
{{                </plugin>}}
{{            </plugins>}}
{{        </pluginManagement>}}

 

Currently, it is "3.2.1", which reproduces the warning. If you build the archetype with "mvn clean install", you will see the warning already when a sample project is generated during the test.

Otherwise, you can create a project later with this command:

{{mvn archetype:generate -DarchetypeCatalog=local -DgroupId=foo.bar -DartifactId=multi -Dversion=0.1-SNAPSHOT -Dpackage=foo.bar.multi -DarchetypeGroupId=org.wildfly.archetype -DarchetypeArtifactId=wildfly-jakartaee-ear-archetype_ARCHETYPE-649 -DarchetypeVersion=30.0.0.Final-SNAPSHOT}}

Change the version to "3.1.2" and rebuild it, and there is no warning.

The warning seems to be caused by the fact that the project has modules. In a simpler archetype without modules, the problem does not happen.

> "[WARNING] CP Don't override file" when generating archetype with 3.2.1
> -----------------------------------------------------------------------
>
>                 Key: ARCHETYPE-649
>                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-649
>             Project: Maven Archetype
>          Issue Type: Bug
>          Components: Creator
>    Affects Versions: 3.2.1
>            Reporter: Wolfgang Knauf
>            Priority: Major
>         Attachments: archetype-metadata.xml, wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT_312.jar, wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT_321.jar, wildfly-jakartaee-ear-archetype_ARCHETYPE-649.zip
>
>
> I do some maintenance work on the "wildfly-jakartaee-ear-archetype". After updating "maven-archetype-plugin" to 3.2.1, there are two warnings printed when creating a project from the archetype.
> {quote}{{[WARNING] Don't override file ...\multi\project\multi\web\src\test\java\foo\bar\multi}}
> {{[WARNING] CP Don't override file ...\multi\project\multi\web\src\main\webapp}}{quote}
>  
> I think the problem depends on the archetype-plugin version that creates the archetype JAR. Attached are the jar files from my local repository. One is created with archetype-plugin 3.1.2, the other with 3.2.1.
> [^wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT_321.jar]
> [^wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT_312.jar]
> Note the size difference of the two jar files.
> When creating a project from the archetype, the message appears with both 3.1.2 and 3.2.1, if the archetype jar was created with 3.2.1. It does not appear when the archetype jar was created with the 3.1.2 plugin.
>  
> Debug logging during generating of the project from the archetype seems to point me to the reason: with 3.2.1, the jar file contains a lot of entries for the directories. With 3.1.2, there are only entries for "real" files.
> This seems to cause duplicates with the fileSets in "archetype-metadata.xml"
>  
> Here is the log when the archetype jar was created with 3.1.2:
>  
> {{[DEBUG] getFilesetArchetypeResources( "C:\Users\USERNAME\.m2\repository\org\wildfly\archetype\wildfly-jakartaee-ear-archetype\30.0.0.Final-SNAPSHOT\wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT.jar" )}}
> {{[DEBUG]   - found resource (archetype-resources/)ear/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/main/resources/META-INF/persistence.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/test/resources/arquillian.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)README.txt}}
> {{[DEBUG]   - found resource (archetype-resources/)web/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/WEB-INF/beans.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/WEB-INF/faces-config.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/java/test/SampleIT.java}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/resources/arquillian.xml}}
> {{[DEBUG]   - ignored resource META-INF/maven/archetype-metadata.xml}}
> {{[DEBUG] Processing complete archetype wildfly-jakartaee-webapp-ear-archetype}}
>  
> And this is the output for an archetype created with 3.2.1:
>  
> {{[DEBUG] getFilesetArchetypeResources( "C:\Users\USERNAME\.m2\repository\org\wildfly\archetype\wildfly-jakartaee-ear-archetype\30.0.0.Final-SNAPSHOT\wildfly-jakartaee-ear-archetype-30.0.0.Final-SNAPSHOT.jar" )}}
> {{[DEBUG]   - ignored resource META-INF/MANIFEST.MF}}
> {{[DEBUG]   - ignored resource META-INF/}}
> {{[DEBUG]   - found resource (archetype-resources/)}}
> {{[DEBUG]   - found resource (archetype-resources/)ear/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/main/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/main/resources/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/main/resources/META-INF/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/test/}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/test/resources/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/WEB-INF/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/java/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/java/test/}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/resources/}}
> {{[DEBUG]   - ignored resource META-INF/maven/}}
> {{[DEBUG]   - ignored resource META-INF/maven/org.wildfly.archetype/}}
> {{[DEBUG]   - ignored resource META-INF/maven/org.wildfly.archetype/wildfly-jakartaee-ear-archetype/}}
> {{[DEBUG]   - found resource (archetype-resources/)ear/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/main/resources/META-INF/persistence.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)ejb/src/test/resources/arquillian.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)README.txt}}
> {{[DEBUG]   - found resource (archetype-resources/)web/pom.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/WEB-INF/beans.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/main/webapp/WEB-INF/faces-config.xml}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/java/test/SampleIT.java}}
> {{[DEBUG]   - found resource (archetype-resources/)web/src/test/resources/arquillian.xml}}
> {{[DEBUG]   - ignored resource META-INF/maven/archetype-metadata.xml}}
> {{[DEBUG]   - ignored resource META-INF/maven/org.wildfly.archetype/wildfly-jakartaee-ear-archetype/pom.xml}}
> {{[DEBUG]   - ignored resource META-INF/maven/org.wildfly.archetype/wildfly-jakartaee-ear-archetype/pom.properties}}
>  
> Unfortunately, I don't have an easy to reproduce sample - the "[wildfly-jakartaee-ear-archetype|https://github.com/wildfly/wildfly-archetypes]" contains some additional stuff.
>  
> For completeness, I attached[^archetype-metadata.xml] with several "fileSet" definitions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)