[
https://issues.apache.org/jira/browse/ARCHETYPE-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14679171#comment-14679171
]
Hervé Boutemy commented on ARCHETYPE-483:
-----------------------------------------
how was this issue fixed in 2.4, please?
was there a related commit or is it just cleaning of an old issue?
> Building a new 2.X archetype with JarMojo writes out a nonsensical warning
> --------------------------------------------------------------------------
>
> Key: ARCHETYPE-483
> URL: https://issues.apache.org/jira/browse/ARCHETYPE-483
> Project: Maven Archetype
> Issue Type: Bug
> Components: Plugin
> Affects Versions: 2.3
> Reporter: Tomáš Zilvar
> Priority: Trivial
> Labels: build, easyfix, newbie
> Fix For: 2.4
>
>
> When packaging a new style 2.0 custom archetype JAR with JarMojo, the build
> issues a counter-intuitive warning:
> {noformat}
> [WARNING] Building an Old (1.x) Archetype: consider migrating it to current
> 2.x Archetype.
> {noformat}
> I suppose that it is because of an inverted if condition in
> JarMojo.checkArchetypeFile(File file)
> {code:title=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 );
> }
> }
> //...
> }
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)