Hi guys,

I'm writing here to ask what I have found is a bug or not. I have a project
and I want to create an archetype out of it. So I use the following command:

mvn archetype:create-from-project
-Darchetype.properties=src/main/resources/archetype.properties

It used to work fine with maven-archetype<=2.4 but now with 3.0 it fails
with:

Caused by: org.apache.maven.plugin.MojoFailureException: Error reading
parent POM of project: com.nemesis:bom:1.5.0.BUILD-SNAPSHOT
    at
org.apache.maven.archetype.mojos.CreateArchetypeFromProjectMojo.execute(CreateArchetypeFromProjectMojo.java:269)
    at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)

I started debugging and I found out that the problem is in this commit:

https://github.com/apache/maven-archetype/commit/624f9affdc27c8efe6443e03e89259dbe51d08dd

which migrates the plugin to Maven3.

Furthermore debugging and stacktrace analysis revealed this:


*[ERROR] Failed to determine Java version for profile doclint-java8-disable
@ org.jboss:jboss-parent:19,
/home/petar/.m2/repository/org/jboss/jboss-parent/19/jboss-parent-19.pom,
line 746, column 15*
and indeed inside my parent pom.xml I have included the jboss bom like this:

            <dependency>
                <groupId>org.drools</groupId>
                <artifactId>drools-bom</artifactId>
                <type>pom</type>
                <version>${drools.version}</version>
                <scope>import</scope>
            </dependency>

which has a parent the jboss-parent.

Now if you debug further more in the maven-archetype-plugin you will see
here:

https://github.com/apache/maven-archetype/blob/master/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java#L439

we create a new DefaultProjectBuildingRequest and don't set any system
properties to it
so it eventually gets passed down to maven-core which cannot find
"java.version"
system property (because there are no properties passed) and it adds the
error that I see.

Now I have a several questions: why have we left the ProjectBuildingRequest
without system properties? Also the ProjectBuildingRequest has no
userProperties set - is this OK? I can fix the system properties with:

buildingRequest.setSystemProperties( System.getProperties() );
buildingRequest.setUserProperties( configurationProperties );

but is this correct?


-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Reply via email to