You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Petar Tahchiev (JIRA)" <ji...@apache.org> on 2015/08/09 16:10:45 UTC

[jira] [Resolved] (ARCHETYPE-483) Building a new 2.X archetype with JarMojo writes out a nonsensical warning

     [ https://issues.apache.org/jira/browse/ARCHETYPE-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Petar Tahchiev resolved ARCHETYPE-483.
--------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4

> 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)