Description
When packaging a new style 2.0 custom archetype JAR with JarMojo, the build issues a counter-intuitive warning:
[WARNING] Building an Old (1.x) Archetype: consider migrating it to current 2.x Archetype.
I suppose that it is because of an inverted if condition in JarMojo.checkArchetypeFile(File file)
JarMojo.java
package org.apache.maven.archetype.mojos; //... /** * Build a JAR from the current Archetype project. * * @author rafale */ @Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true ) public class JarMojo extends AbstractMojo { //... private void checkArchetypeFile( File jarFile ) throws MojoExecutionException { try { if ( archetypeArtifactManager.isFileSetArchetype( jarFile ) ) { checkFileSetArchetypeFile( jarFile ); } else if ( !archetypeArtifactManager.isOldArchetype( jarFile ) ) { getLog().warn( "Building an Old (1.x) Archetype: consider migrating it to current 2.x Archetype." ); } else { throw new MojoExecutionException( "The current project does not built an archetype" ); } } catch ( UnknownArchetype ua ) { throw new MojoExecutionException( ua.getMessage(), ua ); } } //... }
The condition !archetypeArtifactManager.isOldArchetype( jarFile ) is negated, therefore it issues the warning if the jar is not an old archetype, which makes it downright confusing for new users trying to build a new archetype. On the other hand, when the archetype actually is old, it does not warn at all.