This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
The following commit(s) were added to refs/heads/master by this push:
new 9f593b4 [ARCHETYPE-583] Allow skip non-archetypes
9f593b4 is described below
commit 9f593b46f4519f68e16a8704a578e8cab33884db
Author: Lukasz Lenart <[email protected]>
AuthorDate: Wed Dec 18 19:53:25 2019 +0100
[ARCHETYPE-583] Allow skip non-archetypes
---
.../src/main/java/org/apache/maven/archetype/common/Constants.java | 3 +++
.../maven/archetype/source/LocalCatalogArchetypeDataSource.java | 6 +++---
.../org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java | 6 ++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git
a/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
b/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
index db5ce46..34f8e64 100644
---
a/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
+++
b/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
@@ -97,4 +97,7 @@ public interface Constants
String TMP = ".tmp";
String VERSION = "version";
+
+ String MAVEN_ARCHETYPE_PACKAGING = "maven-archetype";
+
}
diff --git
a/archetype-common/src/main/java/org/apache/maven/archetype/source/LocalCatalogArchetypeDataSource.java
b/archetype-common/src/main/java/org/apache/maven/archetype/source/LocalCatalogArchetypeDataSource.java
index 9f2a9d5..ad378b2 100644
---
a/archetype-common/src/main/java/org/apache/maven/archetype/source/LocalCatalogArchetypeDataSource.java
+++
b/archetype-common/src/main/java/org/apache/maven/archetype/source/LocalCatalogArchetypeDataSource.java
@@ -48,14 +48,14 @@ public class LocalCatalogArchetypeDataSource
File catalogFile = new File( localRepo, ARCHETYPE_CATALOG_FILENAME );
- getLogger().debug( "Using catalog " + catalogFile.getAbsolutePath() );
+ getLogger().debug( "Catalog to be used for update: " +
catalogFile.getAbsolutePath() );
ArchetypeCatalog catalog;
if ( catalogFile.exists() )
{
try
{
- getLogger().debug( "Reading the catalog " + catalogFile );
+ getLogger().debug( "Reading catalog to be updated: " +
catalogFile );
catalog = readCatalog( ReaderFactory.newXmlReader( catalogFile
) );
}
catch ( FileNotFoundException ex )
@@ -113,7 +113,7 @@ public class LocalCatalogArchetypeDataSource
{
catalogFile = new File( catalogFile, ARCHETYPE_CATALOG_FILENAME );
}
- getLogger().debug( "Using catalog " + catalogFile );
+ getLogger().debug( "Getting archetypes from catalog: " + catalogFile );
if ( catalogFile.exists() )
{
diff --git
a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
index 767d30d..096fb5a 100644
---
a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
+++
b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
@@ -21,6 +21,7 @@ package org.apache.maven.archetype.mojos;
import org.apache.maven.archetype.ArchetypeManager;
import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.archetype.common.Constants;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -56,6 +57,11 @@ public class UpdateLocalCatalogMojo
public void execute()
throws MojoExecutionException
{
+ if ( !Constants.MAVEN_ARCHETYPE_PACKAGING.equalsIgnoreCase(
project.getPackaging() ) )
+ {
+ getLog().debug( "Wrong packaging type " + project.getPackaging() +
", skipping archetype " + project.getName() );
+ return;
+ }
Archetype archetype = new Archetype();
archetype.setGroupId( project.getGroupId() );
archetype.setArtifactId( project.getArtifactId() );