maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé Boutemy (JIRA) <j...@apache.org>
Subject [jira] [Commented] (ARCHETYPE-483) Building a new 2.X archetype with JarMojo writes out a nonsensical warning
Date Sun, 09 Aug 2015 15:33:45 GMT

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

Hervé Boutemy commented on ARCHETYPE-483:
-----------------------------------------

ok, found the commit
[ad3e8681708c30ff3ea434100815df756866c8e7|https://git-wip-us.apache.org/repos/asf?p=maven-archetype.git;a=commit;h=ad3e8681708c30ff3ea434100815df756866c8e7]

you should start comment with the Jira issue id (as Maven git conventions http://maven.apache.org/developers/conventions/git.html
)
with these, Jenkins will add a comment with the link to the issue

now, please add such a link by hand to recent issues: you won't forget the convention ;)

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

Mime
View raw message