You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2020/04/16 10:43:13 UTC
[maven-ear-plugin] 03/24: Improved configuration. Leave only needed
dependencies.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch itf-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 78f366fcce081a483fbe6923c1e8d2e90f184fa5
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:25:47 2019 +0100
Improved configuration. Leave only needed dependencies.
---
pom.xml | 18 -------
src/it/basic/pom.xml | 45 ----------------
.../application/META-INF/appserver-application.xml | 22 --------
src/it/basic/verify.bsh | 49 -----------------
src/it/packaging-excludes/pom.xml | 53 ------------------
src/it/packaging-excludes/verify.bsh | 61 ---------------------
src/it/packaging-includes/pom.xml | 58 --------------------
src/it/packaging-includes/verify.bsh | 62 ----------------------
src/it/resource-custom-directory/pom.xml | 49 -----------------
.../application/APP-INF/classes/foo.properties | 18 -------
src/it/resource-custom-directory/verify.bsh | 49 -----------------
.../org/apache/maven/plugins/ear/it/EARIT.java | 20 +++++++
12 files changed, 20 insertions(+), 484 deletions(-)
diff --git a/pom.xml b/pom.xml
index 36e91ee..cdba69a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,24 +181,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-inline</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
diff --git a/src/it/basic/pom.xml b/src/it/basic/pom.xml
deleted file mode 100644
index cb4f225..0000000
--- a/src/it/basic/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.basic</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven Integration Test :: it0033</name>
- <description>Test an EAR generation</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <generateApplicationXml>true</generateApplicationXml>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/basic/src/main/application/META-INF/appserver-application.xml b/src/it/basic/src/main/application/META-INF/appserver-application.xml
deleted file mode 100644
index 76c25e0..0000000
--- a/src/it/basic/src/main/application/META-INF/appserver-application.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-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.
--->
-<appserver-app>
- <whatever/>
-</appserver-app>
diff --git a/src/it/basic/verify.bsh b/src/it/basic/verify.bsh
deleted file mode 100644
index 0e96a92..0000000
--- a/src/it/basic/verify.bsh
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "META-INF/appserver-application.xml",
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/packaging-excludes/pom.xml b/src/it/packaging-excludes/pom.xml
deleted file mode 100644
index 8f7419e..0000000
--- a/src/it/packaging-excludes/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.packagingexcludes</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: packaging excludes</name>
- <description>Test EAR generation using packaging excludes</description>
-
- <dependencies>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <packagingExcludes>commons-lang-*.jar</packagingExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/packaging-excludes/verify.bsh b/src/it/packaging-excludes/verify.bsh
deleted file mode 100644
index 4cc3c9c..0000000
--- a/src/it/packaging-excludes/verify.bsh
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "META-INF/MANIFEST.MF"
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-String[] excludedEntries = {
- "commons-lang-commons-lang-2.5.jar"
-};
-for ( String excluded : excludedEntries )
-{
- System.out.println( "Checking for excluded artifact " + excluded );
- if ( jar.getEntry( excluded ) != null )
- {
- throw new IllegalStateException( "Archive entry should be excluded: " + excluded );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/packaging-includes/pom.xml b/src/it/packaging-includes/pom.xml
deleted file mode 100644
index c37ae70..0000000
--- a/src/it/packaging-includes/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.packagingincludes</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: packaging includes</name>
- <description>Test EAR generation using packaging includes</description>
-
- <dependencies>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <packagingIncludes>commons-lang-*.jar,META-INF/**</packagingIncludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/packaging-includes/verify.bsh b/src/it/packaging-includes/verify.bsh
deleted file mode 100644
index f8e2415..0000000
--- a/src/it/packaging-includes/verify.bsh
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "commons-lang-commons-lang-2.5.jar",
- "META-INF/application.xml",
- "META-INF/MANIFEST.MF"
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-String[] excludedEntries = {
- "commons-io-1.4.jar"
-};
-for ( String excluded : excludedEntries )
-{
- System.out.println( "Checking for excluded artifact " + excluded );
- if ( jar.getEntry( excluded ) != null )
- {
- throw new IllegalStateException( "Archive entry should be excluded: " + excluded );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/resource-custom-directory/pom.xml b/src/it/resource-custom-directory/pom.xml
deleted file mode 100644
index 4a1b69b..0000000
--- a/src/it/resource-custom-directory/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.resourcecustomdirectory</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: resource custom directory</name>
- <description>Test filtering of a custom directory</description>
-
- <properties>
- <filtered.value>Hello World!</filtered.value>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <filtering>true</filtering>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties b/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
deleted file mode 100644
index 08481f0..0000000
--- a/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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.
-
-test.property=${filtered.value}
\ No newline at end of file
diff --git a/src/it/resource-custom-directory/verify.bsh b/src/it/resource-custom-directory/verify.bsh
deleted file mode 100644
index 41b23b7..0000000
--- a/src/it/resource-custom-directory/verify.bsh
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "APP-INF/classes/foo.properties",
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 147ae4c..3863992 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -26,10 +26,27 @@ import org.apache.maven.jupiter.extension.MavenTest;
import org.apache.maven.jupiter.extension.maven.MavenExecutionResult;
import org.apache.maven.jupiter.extension.maven.MavenLog;
import org.apache.maven.jupiter.extension.maven.MavenProjectResult;
+import org.junit.jupiter.api.DisplayName;
+/**
+ * Examples taken from Maven EAR Plugin
+ *
+ * Invoker Integration Test:
+ * <ul>
+ * <li>basic</li>
+ * <li>packaging_includes</li>
+ * <li>packaging_excludes</li>
+ * <li>resource_custom_directory</li>
+ * </ul>
+ *
+ * @author Karl Heinz Marbaise
+ */
@MavenIT
+@DisplayName("EAR Plugin Integration tests")
class EARIT {
+
@MavenTest
+ @DisplayName("Basic configuration. Should simply create an ear file.")
void basic(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -38,6 +55,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Packging includes defined.")
void packaging_includes(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -47,6 +65,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Packging excludes defined to prevent adding commons-lang-2.5 into the ear file.")
void packaging_excludes(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -56,6 +75,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Filtering of a custom directory (likely wrong!)")
void resource_custom_directory(MavenExecutionResult result, MavenProjectResult project, MavenLog log) {
assertThat(result).isSuccessful();
assertThat(log).isSuccessful();