You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2023/04/15 21:25:09 UTC
[maven-acr-plugin] branch MACR-56 created (now ed96d9b)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch MACR-56
in repository https://gitbox.apache.org/repos/asf/maven-acr-plugin.git
at ed96d9b [MACR-56] Upgrade dependencies
This branch includes the following new commits:
new e918db9 [MACR-56] Upgrade Parent Pom to 39
new 039adf3 [MACR-56] Formatting
new ed96d9b [MACR-56] Upgrade dependencies
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-acr-plugin] 03/03: [MACR-56] Upgrade dependencies
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MACR-56
in repository https://gitbox.apache.org/repos/asf/maven-acr-plugin.git
commit ed96d9bac5411d65d474c1bd82bc13e4d8b5a95b
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Apr 15 23:24:28 2023 +0200
[MACR-56] Upgrade dependencies
---
pom.xml | 18 ++++---
src/it/it-01/verify.bsh | 68 -------------------------
src/it/it-01/verify.groovy | 60 ++++++++++++++++++++++
src/it/it-02/verify.bsh | 80 ------------------------------
src/it/it-02/verify.groovy | 70 ++++++++++++++++++++++++++
src/it/it-03/{verify.bsh => verify.groovy} | 45 +++++++----------
src/it/it-04/verify.bsh | 72 ---------------------------
src/it/it-04/verify.groovy | 62 +++++++++++++++++++++++
8 files changed, 221 insertions(+), 254 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5987033..24c7ebc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,7 @@ under the License.
<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.2.5</mavenVersion>
+ <maven.plugin.tools.version>3.8.1</maven.plugin.tools.version>
<project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp>
</properties>
@@ -92,18 +93,13 @@ under the License.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
- <version>3.5.0</version>
+ <version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>3.1.1</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interpolation</artifactId>
- <version>1.26</version>
- </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
@@ -112,12 +108,12 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
- <version>4.2.2</version>
+ <version>4.6.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.6</version>
+ <version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -125,6 +121,11 @@ under the License.
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-shared-utils</artifactId>
+ <version>3.3.4</version>
+ </dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
@@ -150,6 +151,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
+ <version>3.5.1</version>
<configuration>
<goals>
<goal>clean</goal>
diff --git a/src/it/it-01/verify.bsh b/src/it/it-01/verify.bsh
deleted file mode 100644
index 6843b96..0000000
--- a/src/it/it-01/verify.bsh
+++ /dev/null
@@ -1,68 +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.*;
-
-try
-{
- File jarFile = new File( basedir, "target/maven-acr-plugin-it01-1.0.jar" );
- System.out.println( "Checking for existence of " + jarFile );
- if ( !jarFile.isFile() )
- {
- System.out.println( "FAILURE!" );
- return false;
- }
-
- JarFile jar = new JarFile( jarFile );
-
- String[] includedEntries = {
- "META-INF/application-client.xml",
- "org/apache/maven/plugin/acr/it/it01/SampleApp.class",
- };
- for ( String included : includedEntries )
- {
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- System.out.println( "FAILURE!" );
- return false;
- }
- }
-
- jar.close();
-
- // Make sure that the jar has been added with a .jar extension
- File localRepo = new File( basedir.getParentFile().getParentFile(), "local-repo" );
- File repoFile = new File(localRepo,
- "/org/apache/maven/plugin/maven-acr-plugin-it01/1.0/maven-acr-plugin-it01-1.0.jar");
- if (!repoFile.exists()) {
- System.out.println("Jar file for application client not found in repo [" + repoFile.getAbsolutePath() + "]");
- return false;
- }
-}
-catch( Throwable t )
-{
- t.printStackTrace();
- return false;
-}
-
-return true;
diff --git a/src/it/it-01/verify.groovy b/src/it/it-01/verify.groovy
new file mode 100644
index 0000000..2adf593
--- /dev/null
+++ b/src/it/it-01/verify.groovy
@@ -0,0 +1,60 @@
+/*
+ * 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.util.jar.JarFile
+
+try {
+ var jarFile = new File(basedir, "target/maven-acr-plugin-it01-1.0.jar")
+ println "Checking for existence of $jarFile"
+ if (!jarFile.isFile()) {
+ println "FAILURE!"
+ return false;
+ }
+
+ var jar = new JarFile(jarFile)
+
+ var includedEntries = [
+ "META-INF/application-client.xml",
+ "org/apache/maven/plugin/acr/it/it01/SampleApp.class"
+ ]
+ for (String included : includedEntries) {
+ println "Checking for existence of $included"
+ if (jar.getEntry(included) == null) {
+ println "FAILURE!"
+ return false
+ }
+ }
+
+ jar.close()
+
+ // Make sure that the jar has been added with a .jar extension
+ var localRepo = new File(basedir.getParentFile().getParentFile(), "local-repo")
+ var repoFile = new File(localRepo,
+ "/org/apache/maven/plugin/maven-acr-plugin-it01/1.0/maven-acr-plugin-it01-1.0.jar");
+ if (!repoFile.exists()) {
+ println "Jar file for application client not found in repo [" + repoFile.getAbsolutePath() + "]"
+ return false
+ }
+}
+catch (Throwable t) {
+ t.printStackTrace()
+ return false
+}
+
+return true
diff --git a/src/it/it-02/verify.bsh b/src/it/it-02/verify.bsh
deleted file mode 100644
index 1770500..0000000
--- a/src/it/it-02/verify.bsh
+++ /dev/null
@@ -1,80 +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.*;
-
-try
-{
- File jarFile = new File( basedir, "app-client/target/maven-acr-plugin-it02-app-client-1.0.jar" );
- System.out.println( "Checking for existence of " + jarFile );
- if ( !jarFile.isFile() )
- {
- System.out.println( "FAILURE!" );
- return false;
- }
-
- JarFile jar = new JarFile( jarFile );
-
- String[] includedEntries = {
- "META-INF/application-client.xml",
- "org/apache/maven/plugin/acr/it/it02/SampleApp.class",
- };
- for ( String included : includedEntries )
- {
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- System.out.println( "FAILURE!" );
- return false;
- }
- }
-
- jar.close();
-
- File bundleJarFile = new File( basedir, "bundle/target/maven-acr-plugin-it02-bundle-1.0.jar" );
- JarFile bundle = new JarFile( bundleJarFile );
-
-
- String[] includedBundleEntries = {
- "org/apache/maven/plugin/acr/it/it02/DependencyTest.class",
- };
- for ( String included : includedBundleEntries )
- {
- System.out.println( "Checking for existence of " + included );
- if ( bundle.getEntry( included ) == null )
- {
- System.out.println( "FAILURE!" );
- return false;
- }
- }
-
- bundle.close();
-
-
-}
-catch( Throwable t )
-{
- t.printStackTrace();
- return false;
-}
-
-return true;
diff --git a/src/it/it-02/verify.groovy b/src/it/it-02/verify.groovy
new file mode 100644
index 0000000..462749d
--- /dev/null
+++ b/src/it/it-02/verify.groovy
@@ -0,0 +1,70 @@
+/*
+ * 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.util.jar.JarFile
+
+try {
+ var jarFile = new File(basedir, "app-client/target/maven-acr-plugin-it02-app-client-1.0.jar")
+ println "Checking for existence of $jarFile"
+ if (!jarFile.isFile()) {
+ println "FAILURE!"
+ return false
+ }
+
+ var jar = new JarFile(jarFile)
+
+ var includedEntries = [
+ "META-INF/application-client.xml",
+ "org/apache/maven/plugin/acr/it/it02/SampleApp.class"
+ ]
+ for (String included : includedEntries) {
+ println "Checking for existence of $included"
+ if (jar.getEntry(included) == null) {
+ println "FAILURE!"
+ return false
+ }
+ }
+
+ jar.close()
+
+ var bundleJarFile = new File(basedir, "bundle/target/maven-acr-plugin-it02-bundle-1.0.jar")
+ var bundle = new JarFile(bundleJarFile);
+
+
+ var includedBundleEntries = [
+ "org/apache/maven/plugin/acr/it/it02/DependencyTest.class"
+ ]
+ for (String included : includedBundleEntries) {
+ println "Checking for existence of $included"
+ if (bundle.getEntry(included) == null) {
+ println "FAILURE!"
+ return false
+ }
+ }
+
+ bundle.close()
+
+
+}
+catch (Throwable t) {
+ t.printStackTrace()
+ return false
+}
+
+return true
diff --git a/src/it/it-03/verify.bsh b/src/it/it-03/verify.groovy
similarity index 52%
rename from src/it/it-03/verify.bsh
rename to src/it/it-03/verify.groovy
index 7a6670d..eee4260 100644
--- a/src/it/it-03/verify.bsh
+++ b/src/it/it-03/verify.groovy
@@ -17,40 +17,33 @@
* under the License.
*/
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/maven-acr-plugin-it03-1.0.jar" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new FileNotFoundException( "Missing " + jarFile );
+import java.util.zip.ZipEntry
+import java.util.zip.ZipInputStream
+
+var jarFile = new File(basedir, "target/maven-acr-plugin-it03-1.0.jar")
+println "Checking for existence of $jarFile"
+if (!jarFile.isFile()) {
+ throw new FileNotFoundException("Missing " + jarFile)
}
-ZipInputStream zis = new ZipInputStream( new FileInputStream( jarFile ) );
+var zis = new ZipInputStream(new FileInputStream(jarFile))
-int count = 0;
+int count = 0
-while (true)
-{
- ZipEntry entry = zis.getNextEntry();
- if ( entry == null )
- {
- break;
+while (true) {
+ var entry = zis.getNextEntry()
+ if (entry == null) {
+ break
}
- if ( entry.getName().equals( "META-INF/application-client.xml" ) )
- {
- count++;
+ if (entry.getName().equals("META-INF/application-client.xml")) {
+ count++
}
}
-zis.close();
+zis.close()
-if ( count != 1 )
-{
- throw new IllegalStateException( "Wrong number of application-client.xml's in archive: " + count );
+if (count != 1) {
+ throw new IllegalStateException("Wrong number of application-client.xml's in archive: " + count)
}
-return true;
+return true
diff --git a/src/it/it-04/verify.bsh b/src/it/it-04/verify.bsh
deleted file mode 100644
index 7a8d156..0000000
--- a/src/it/it-04/verify.bsh
+++ /dev/null
@@ -1,72 +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.*;
-import java.util.zip.ZipEntry;
-import org.codehaus.plexus.util.IOUtil;
-
-try
-{
- File file = new File( basedir, "target/maven-acr-plugin-it04-1.0.jar" );
- System.out.println( "Checking for existence of " + file );
- if ( !file.isFile() )
- {
- System.out.println( "FAILURE! Missing JAR file" );
- return false;
- }
-
- JarFile jarFile = new JarFile( file );
-
- ZipEntry zipEntry = jarFile.getEntry( "META-INF/application-client.xml" );
- if ( zipEntry == null )
- {
- System.out.println( "FAILURE! Missing META-INF/application-client.xml in the JAR file" );
- return false;
- }
- else
- {
- InputStream is = jarFile.getInputStream( zipEntry );
- String contents = IOUtil.toString ( is, "UTF-8" );
- int index = contents.indexOf( "it04.key.value" );
- if ( index >= 0 )
- {
- System.out.println( "FAILURE! The key 'it04.key.value' has not been replaced during filtering" );
- return false;
- }
- index = contents.indexOf( "it04-success" );
- if ( index < 0 )
- {
- System.out.println( "FAILURE! The value 'it04-success' has not been injected during filtering" );
- return false;
- }
- is.close();
- }
-
- jarFile.close();
-}
-catch( Throwable t )
-{
- t.printStackTrace();
- return false;
-}
-
-return true;
diff --git a/src/it/it-04/verify.groovy b/src/it/it-04/verify.groovy
new file mode 100644
index 0000000..0e9e745
--- /dev/null
+++ b/src/it/it-04/verify.groovy
@@ -0,0 +1,62 @@
+/*
+ * 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 org.codehaus.plexus.util.IOUtil
+
+import java.util.jar.JarFile
+
+try {
+ var file = new File(basedir, "target/maven-acr-plugin-it04-1.0.jar")
+ println "Checking for existence of $file"
+ if (!file.isFile()) {
+ println "FAILURE! Missing JAR file"
+ return false
+ }
+
+ var jarFile = new JarFile(file)
+
+ var zipEntry = jarFile.getEntry("META-INF/application-client.xml")
+ if (zipEntry == null) {
+ println "FAILURE! Missing META-INF/application-client.xml in the JAR file"
+ return false
+ } else {
+ var is = jarFile.getInputStream(zipEntry)
+ var contents = IOUtil.toString(is, "UTF-8")
+ var index = contents.indexOf("it04.key.value");
+ if (index >= 0) {
+ println "FAILURE! The key 'it04.key.value' has not been replaced during filtering"
+ return false
+ }
+ index = contents.indexOf("it04-success")
+ if (index < 0) {
+ println "FAILURE! The value 'it04-success' has not been injected during filtering"
+ return false
+ }
+ is.close()
+ }
+
+ jarFile.close()
+}
+catch (Throwable t) {
+ t.printStackTrace()
+ return false
+}
+
+return true
[maven-acr-plugin] 02/03: [MACR-56] Formatting
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MACR-56
in repository https://gitbox.apache.org/repos/asf/maven-acr-plugin.git
commit 039adf37509e06f342ee845ecaa239d2af06b9a7
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Apr 15 21:25:01 2023 +0200
[MACR-56] Formatting
---
pom.xml | 10 +-
.../java/org/apache/maven/plugins/acr/AcrMojo.java | 179 ++++++++++-----------
2 files changed, 85 insertions(+), 104 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9857453..5987033 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
+<?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
@@ -18,7 +17,6 @@ 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>
@@ -26,7 +24,7 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>39</version>
- <relativePath/>
+ <relativePath />
</parent>
<artifactId>maven-acr-plugin</artifactId>
@@ -43,8 +41,8 @@ under the License.
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-acr-plugin.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-acr-plugin.git</developerConnection>
- <url>https://github.com/apache/maven-acr-plugin/tree/${project.scm.tag}</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/maven-acr-plugin/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>JIRA</system>
@@ -138,8 +136,8 @@ under the License.
<build>
<resources>
<resource>
- <directory>src/main/filtered-resources</directory>
<filtering>true</filtering>
+ <directory>src/main/filtered-resources</directory>
</resource>
</resources>
</build>
diff --git a/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java b/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
index d75e588..3aac023 100644
--- a/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
+++ b/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.acr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.acr;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.acr;
import java.io.File;
import java.io.IOException;
@@ -52,23 +51,24 @@ import org.codehaus.plexus.util.FileUtils;
* @author <a href="pablo@anahata-it.com">Pablo Rodriguez</a>
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
*/
-@Mojo( name = "acr", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true,
- defaultPhase = LifecyclePhase.PACKAGE )
-public class AcrMojo
- extends AbstractMojo
-{
+@Mojo(
+ name = "acr",
+ requiresDependencyResolution = ResolutionScope.RUNTIME,
+ threadSafe = true,
+ defaultPhase = LifecyclePhase.PACKAGE)
+public class AcrMojo extends AbstractMojo {
private static final String APP_CLIENT_XML = "META-INF/application-client.xml";
// TODO: will null work instead?
- private static final String[] DEFAULT_INCLUDES = { "**/**" };
+ private static final String[] DEFAULT_INCLUDES = {"**/**"};
- private static final String[] DEFAULT_EXCLUDES = { APP_CLIENT_XML };
+ private static final String[] DEFAULT_EXCLUDES = {APP_CLIENT_XML};
/**
* The directory for the generated jar.
*/
- @Parameter( defaultValue = "${project.build.directory}", required = true, readonly = true )
+ @Parameter(defaultValue = "${project.build.directory}", required = true, readonly = true)
private File basedir;
/**
@@ -76,25 +76,25 @@ public class AcrMojo
* Starting with <b>3.0.0</b> the property has been renamed from <code>outputDirectory</code> to
* <code>maven.acr.outputDirectory</code>.
*/
- @Parameter( property = "maven.acr.outputDirectory", defaultValue = "${project.build.outputDirectory}" )
+ @Parameter(property = "maven.acr.outputDirectory", defaultValue = "${project.build.outputDirectory}")
private File outputDirectory;
/**
* The name of the Application client JAR file to generate.
*/
- @Parameter( defaultValue = "${project.build.finalName}" )
+ @Parameter(defaultValue = "${project.build.finalName}")
private String jarName;
/**
* The files and directories to exclude from the main Application Client jar. Usage:
* <p/>
- *
+ *
* <pre>
* <excludes>
* <exclude>**/*DevOnly.class</exclude>
* </excludes>
* </pre>
- *
+ *
* <br/>
* Default exclusions: META-INF/application-client.xml,
*/
@@ -104,13 +104,13 @@ public class AcrMojo
/**
* The Maven project.
*/
- @Parameter( defaultValue = "${project}", readonly = true, required = true )
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
/**
* The Jar archiver.
*/
- @Component( role = Archiver.class, hint = "jar" )
+ @Component(role = Archiver.class, hint = "jar")
private JarArchiver jarArchiver;
/**
@@ -125,7 +125,7 @@ public class AcrMojo
* Starting with <b>3.0.0</b> the property has been renamed from <code>acr.escapeBackslashesInFilePath</code> to
* <code>maven.acr.escapeBackslashesInFilePath</code>.
*/
- @Parameter( property = "maven.acr.escapeBackslashesInFilePath", defaultValue = "false" )
+ @Parameter(property = "maven.acr.escapeBackslashesInFilePath", defaultValue = "false")
private boolean escapeBackslashesInFilePath;
/**
@@ -133,14 +133,14 @@ public class AcrMojo
* Starting with <b>3.0.0</b> the property has been renamed from <code>acr.escapeString</code> to
* <code>maven.acr.escapeString</code>.
*/
- @Parameter( property = "maven.acr.escapeString" )
+ @Parameter(property = "maven.acr.escapeString")
private String escapeString;
/**
* To filter the deployment descriptor. Starting with <b>3.0.0</b> the property has been renamed from
* <code>acr.filterDeploymentDescriptor</code> to <code>maven.acr.filterDeploymentDescriptor</code>.
*/
- @Parameter( property = "maven.acr.filterDeploymentDescriptor", defaultValue = "false" )
+ @Parameter(property = "maven.acr.filterDeploymentDescriptor", defaultValue = "false")
private boolean filterDeploymentDescriptor;
/**
@@ -151,12 +151,12 @@ public class AcrMojo
/**
*/
- @Component( role = MavenFileFilter.class, hint = "default" )
+ @Component(role = MavenFileFilter.class, hint = "default")
private MavenFileFilter mavenFileFilter;
/**
*/
- @Parameter( defaultValue = "${session}", readonly = true, required = true )
+ @Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;
/**
@@ -166,108 +166,95 @@ public class AcrMojo
*
* @since 3.2.0
*/
- @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+ @Parameter(defaultValue = "${project.build.outputTimestamp}")
private String outputTimestamp;
/** {@inheritDoc} */
- public void execute()
- throws MojoExecutionException
- {
- if ( getLog().isInfoEnabled() )
- {
- getLog().info( "Building JavaEE Application client: " + jarName );
+ public void execute() throws MojoExecutionException {
+ if (getLog().isInfoEnabled()) {
+ getLog().info("Building JavaEE Application client: " + jarName);
}
-
- File jarFile = getAppClientJarFile( basedir, jarName );
+ File jarFile = getAppClientJarFile(basedir, jarName);
MavenArchiver archiver = new MavenArchiver();
- archiver.setArchiver( jarArchiver );
+ archiver.setArchiver(jarArchiver);
- archiver.setCreatedBy( "Maven ACR Plugin", "org.apache.maven.plugins", "maven-acr-plugin" );
+ archiver.setCreatedBy("Maven ACR Plugin", "org.apache.maven.plugins", "maven-acr-plugin");
- archiver.setOutputFile( jarFile );
+ archiver.setOutputFile(jarFile);
// configure for Reproducible Builds based on outputTimestamp value
- archiver.configureReproducible( outputTimestamp );
+ archiver.configureReproducible(outputTimestamp);
- try
- {
+ try {
String[] mainJarExcludes = DEFAULT_EXCLUDES;
- if ( excludes != null && !excludes.isEmpty() )
- {
- excludes.add( APP_CLIENT_XML );
- mainJarExcludes = excludes.toArray( new String[0] );
+ if (excludes != null && !excludes.isEmpty()) {
+ excludes.add(APP_CLIENT_XML);
+ mainJarExcludes = excludes.toArray(new String[0]);
}
- if ( outputDirectory.exists() )
- {
- archiver.getArchiver().addDirectory( outputDirectory, DEFAULT_INCLUDES, mainJarExcludes );
- }
- else
- {
+ if (outputDirectory.exists()) {
+ archiver.getArchiver().addDirectory(outputDirectory, DEFAULT_INCLUDES, mainJarExcludes);
+ } else {
// CHECKSTYLE_OFF: LineLength
- getLog().info( "JAR will only contain the META-INF/application-client.xml as no content was marked for inclusion" );
+ getLog().info(
+ "JAR will only contain the META-INF/application-client.xml as no content was marked for inclusion");
// CHECKSTYLE_ON: LineLength
}
- File deploymentDescriptor = new File( outputDirectory, APP_CLIENT_XML );
+ File deploymentDescriptor = new File(outputDirectory, APP_CLIENT_XML);
- if ( deploymentDescriptor.exists() )
- {
- if ( filterDeploymentDescriptor )
- {
- getLog().debug( "Filtering deployment descriptor." );
+ if (deploymentDescriptor.exists()) {
+ if (filterDeploymentDescriptor) {
+ getLog().debug("Filtering deployment descriptor.");
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
- mavenResourcesExecution.setEscapeString( escapeString );
- List<FilterWrapper> filterWrappers =
- mavenFileFilter.getDefaultFilterWrappers( project, filters, escapeBackslashesInFilePath,
- this.session, mavenResourcesExecution );
+ mavenResourcesExecution.setEscapeString(escapeString);
+ List<FilterWrapper> filterWrappers = mavenFileFilter.getDefaultFilterWrappers(
+ project, filters, escapeBackslashesInFilePath, this.session, mavenResourcesExecution);
// Create a temporary file that we can copy-and-filter
- File unfilteredDeploymentDescriptor = new File( outputDirectory, APP_CLIENT_XML + ".unfiltered" );
- FileUtils.copyFile( deploymentDescriptor, unfilteredDeploymentDescriptor );
- mavenFileFilter.copyFile( unfilteredDeploymentDescriptor, deploymentDescriptor, true,
- filterWrappers, getEncoding( unfilteredDeploymentDescriptor ) );
+ File unfilteredDeploymentDescriptor = new File(outputDirectory, APP_CLIENT_XML + ".unfiltered");
+ FileUtils.copyFile(deploymentDescriptor, unfilteredDeploymentDescriptor);
+ mavenFileFilter.copyFile(
+ unfilteredDeploymentDescriptor,
+ deploymentDescriptor,
+ true,
+ filterWrappers,
+ getEncoding(unfilteredDeploymentDescriptor));
// Remove the temporary file
- FileUtils.forceDelete( unfilteredDeploymentDescriptor );
+ FileUtils.forceDelete(unfilteredDeploymentDescriptor);
}
- archiver.getArchiver().addFile( deploymentDescriptor, APP_CLIENT_XML );
+ archiver.getArchiver().addFile(deploymentDescriptor, APP_CLIENT_XML);
}
// create archive
- archiver.createArchive( session, project, archive );
+ archiver.createArchive(session, project, archive);
// CHECKSTYLE_OFF: LineLength
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "There was a problem creating the JavaEE Application Client archive: "
- + e.getMessage(), e );
- }
- catch ( ManifestException e )
- {
- throw new MojoExecutionException( "There was a problem reading / creating the manifest for the JavaEE Application Client archive: "
- + e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "There was a I/O problem creating the JavaEE Application Client archive: "
- + e.getMessage(), e );
- }
- catch ( DependencyResolutionRequiredException e )
- {
- throw new MojoExecutionException( "There was a problem resolving dependencies while creating the JavaEE Application Client archive: "
- + e.getMessage(), e );
- }
- catch ( MavenFilteringException e )
- {
- throw new MojoExecutionException( "There was a problem filtering the deployment descriptor: "
- + e.getMessage(), e );
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException(
+ "There was a problem creating the JavaEE Application Client archive: " + e.getMessage(), e);
+ } catch (ManifestException e) {
+ throw new MojoExecutionException(
+ "There was a problem reading / creating the manifest for the JavaEE Application Client archive: "
+ + e.getMessage(),
+ e);
+ } catch (IOException e) {
+ throw new MojoExecutionException(
+ "There was a I/O problem creating the JavaEE Application Client archive: " + e.getMessage(), e);
+ } catch (DependencyResolutionRequiredException e) {
+ throw new MojoExecutionException(
+ "There was a problem resolving dependencies while creating the JavaEE Application Client archive: "
+ + e.getMessage(),
+ e);
+ } catch (MavenFilteringException e) {
+ throw new MojoExecutionException(
+ "There was a problem filtering the deployment descriptor: " + e.getMessage(), e);
}
- project.getArtifact().setFile( jarFile );
+ project.getArtifact().setFile(jarFile);
// CHECKSTYLE_ON: LineLength
}
@@ -279,9 +266,8 @@ public class AcrMojo
* @param finalName the name of the ear file
* @return the Application client JAR file to generate
*/
- private static File getAppClientJarFile( File basedir, String finalName )
- {
- return new File( basedir, finalName + ".jar" );
+ private static File getAppClientJarFile(File basedir, String finalName) {
+ return new File(basedir, finalName + ".jar");
}
/**
@@ -291,11 +277,8 @@ public class AcrMojo
* @return The encoding of the XML-file, or UTF-8 if it's not specified in the file
* @throws IOException if an error occurred while reading the file
*/
- private String getEncoding( File xmlFile )
- throws IOException
- {
- try ( XmlStreamReader xmlReader = new XmlStreamReader( xmlFile ) )
- {
+ private String getEncoding(File xmlFile) throws IOException {
+ try (XmlStreamReader xmlReader = new XmlStreamReader(xmlFile)) {
return xmlReader.getEncoding();
}
}
[maven-acr-plugin] 01/03: [MACR-56] Upgrade Parent Pom to 39
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MACR-56
in repository https://gitbox.apache.org/repos/asf/maven-acr-plugin.git
commit e918db93fce26554f7c970926db53bd532271acc
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Apr 15 21:23:58 2023 +0200
[MACR-56] Upgrade Parent Pom to 39
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d37aba2..9857453 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,8 +25,8 @@ under the License.
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
- <version>34</version>
- <relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>
+ <version>39</version>
+ <relativePath/>
</parent>
<artifactId>maven-acr-plugin</artifactId>