You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/10/07 13:50:58 UTC
[maven-archetype] branch master updated: [ARCHETYPE-531] Treat no
modules element as no modules at all (#27)
This is an automated email from the ASF dual-hosted git repository.
elharo 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 6a89956 [ARCHETYPE-531] Treat no modules element as no modules at all (#27)
6a89956 is described below
commit 6a89956a6ba8031707f1334c29368ca7f86b28c8
Author: Petr Hadraba <ha...@gmail.com>
AuthorDate: Wed Oct 7 15:50:51 2020 +0200
[ARCHETYPE-531] Treat no modules element as no modules at all (#27)
* ARCHETYPE-531: NullPointerException when module not specified or config empty in EAR plugin
---
.../archetype/creator/FilesetArchetypeCreator.java | 5 +-
.../ARCHETYPE-531_ear-modules/invoker.properties | 18 +++++++
.../it/projects/ARCHETYPE-531_ear-modules/pom.xml | 57 ++++++++++++++++++++++
3 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
index 1148f34..6c0a03d 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
@@ -717,7 +717,10 @@ public class FilesetArchetypeCreator
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if ( configuration != null )
{
- Xpp3Dom[] modules = configuration.getChild( "modules" ).getChildren();
+ Xpp3Dom modulesConfiguration = configuration.getChild( "modules" );
+ Xpp3Dom[] modules = modulesConfiguration != null
+ ? modulesConfiguration.getChildren()
+ : new Xpp3Dom[0];
for ( int i = 0; i < modules.length; i++ )
{
Xpp3Dom module = modules[i];
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/invoker.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/invoker.properties
new file mode 100644
index 0000000..735c6b6
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = clean org.apache.maven.plugins:maven-archetype-plugin:${project.version}:create-from-project
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/pom.xml
new file mode 100644
index 0000000..bc4d42f
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-531_ear-modules/pom.xml
@@ -0,0 +1,57 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.archetype.its</groupId>
+ <artifactId>archetype531-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>ear</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>3.0.1</version>
+ <configuration>
+ <!-- provide some configuration here -->
+ <archive>
+ <index>true</index>
+ </archive>
+ <!-- do not specify <modules /> -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>