diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..cf0b5b8d --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,28 @@ +# 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. + +name: GitHub CI + +on: [push, pull_request] + +jobs: + build: + name: Verify + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3 + with: + os-matrix: '[ "ubuntu-latest" ]' + maven-matrix: '[ "3.6.3", "3.9.3" ]' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eda7198c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: java - -jdk: - - openjdk7 #Travis does not support oraclejdk7 anymore - - oraclejdk8 - -# Install the rpmbuild tool we need. -before_install: - - sudo apt-get install rpm - -# We can skip the installation -# step, cause everything will be -# done in script script. -install: true - -script: "mvn --show-version --errors --batch-mode -Prun-its clean verify" - -cache: - directories: - - $HOME/.m2/repository - -branches: - except: - - gh-pages -notifications: - email: - - khmarbaise@apache.org - - dantran@apache.org diff --git a/README.md b/README.md index b88630f4..de132590 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # MojoHaus RPM Maven Plugin This is the [rpm-maven-plugin](http://www.mojohaus.org/rpm-maven-plugin/). - -[![Build Status](https://travis-ci.org/mojohaus/rpm-maven-plugin.svg?branch=master)](https://travis-ci.org/mojohaus/rpm-maven-plugin) + +[![GitHub CI](https://github.com/mojohaus/rpm-maven-plugin/actions/workflows/maven.yml/badge.svg)](https://github.com/mojohaus/rpm-maven-plugin/actions/workflows/maven.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.codehaus.mojo/rpm-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.codehaus.mojo/rpm-maven-plugin) ## Releasing diff --git a/Vagrantfile b/Vagrantfile index f7d5d8c9..1ff9b9db 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,8 +4,7 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Default provider VirtualBox - config.vm.box = "CentOS-6.5-x86_64" - config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" + config.vm.box = "ubuntu/jammy64" config.vm.provider "virtualbox" do |vb| vb.memory = 2048 @@ -15,6 +14,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| prl.customize ["set", :id, "--memsize", 1024] prl.customize ["set", :id, "--cpus", 2] end + config.vm.synced_folder ".", "/vagrant" config.vm.provision "shell", path: "provision.sh" end diff --git a/pom.xml b/pom.xml index 8bdecccc..dd33c639 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.codehaus.mojo mojo-parent - 38 + 76 rpm-maven-plugin @@ -116,8 +116,8 @@ - 2.2.1 - 1.6 + 3.6.3 + 8 ${project.build.directory}/staging/rpm-maven-plugin @@ -126,46 +126,56 @@ org.apache.maven maven-plugin-api ${mavenVersion} + provided org.apache.maven maven-artifact ${mavenVersion} + provided org.apache.maven maven-core ${mavenVersion} + provided org.apache.maven - maven-project + maven-settings ${mavenVersion} + provided org.apache.maven maven-model ${mavenVersion} + provided org.apache.maven.shared maven-filtering - 3.1.1 + 3.3.1 - org.codehaus.plexus - plexus-interpolation - 1.25 + org.apache.maven.shared + maven-shared-utils + 3.4.2 org.codehaus.plexus plexus-archiver - 3.6.0 + 4.7.1 org.codehaus.plexus plexus-utils - 3.1.0 + 4.0.0 + + + org.codehaus.plexus + plexus-io + 3.4.1 org.apache.maven.plugin-tools @@ -174,9 +184,9 @@ provided - org.sonatype.plexus + org.codehaus.plexus plexus-sec-dispatcher - 1.4 + 2.0 @@ -201,10 +211,6 @@ org.apache.maven.plugins maven-plugin-plugin - - - true - mojo-descriptor @@ -236,6 +242,9 @@ ${project.build.testOutputDirectory}/gnupg + + rpm-dirmode/pom.xml + clean install diff --git a/provision.sh b/provision.sh index 325da0b8..b911dba6 100644 --- a/provision.sh +++ b/provision.sh @@ -2,10 +2,10 @@ set -o nounset function install { - rpm -qa | grep -q $1 + dpkg -l $1 if [ $? -ne 0 ]; then echo "Installing $1 ..." - sudo yum install -y $1 + sudo apt-get install -y $1 fi } @@ -14,7 +14,7 @@ function install_mvn { if [ $? -ne 0 ]; then echo "Installing Apache Maven $1" cd /tmp && - wget -q http://archive.apache.org/dist/maven/binaries/apache-maven-$1-bin.tar.gz && + wget -q http://archive.apache.org/dist/maven/maven-3/$1/binaries/apache-maven-$1-bin.tar.gz && cd /opt && sudo tar -xzf /tmp/apache-maven-$1-bin.tar.gz @@ -22,9 +22,11 @@ function install_mvn { fi } -install java-1.7.0-openjdk-devel -install rpm-build +apt-get update + +install openjdk-17-jdk +install rpm install wget -install_mvn 2.2.1 +install_mvn 3.9.3 echo "Provisioning completed." diff --git a/src/it/rpm-artifact/pom.xml b/src/it/rpm-artifact/pom.xml index b9f6ba36..27497f21 100644 --- a/src/it/rpm-artifact/pom.xml +++ b/src/it/rpm-artifact/pom.xml @@ -23,6 +23,8 @@ UTF-8 + 1.8 + 1.8 diff --git a/src/it/rpm-dirmode/invoker.properties b/src/it/rpm-dirmode/invoker.properties index 60a19911..0d517c07 100644 --- a/src/it/rpm-dirmode/invoker.properties +++ b/src/it/rpm-dirmode/invoker.properties @@ -1 +1 @@ -invoker.goals = clean install +invoker.goals = clean install \ No newline at end of file diff --git a/src/it/rpm-dirmode/verify.groovy b/src/it/rpm-dirmode/verify.groovy index 7588631d..35c3c22d 100644 --- a/src/it/rpm-dirmode/verify.groovy +++ b/src/it/rpm-dirmode/verify.groovy @@ -57,4 +57,4 @@ lines = proc.in.text.readLines() if (lines.size() != 38) throw new AssertionError("Expected: 38 file/dir/links but got: ${lines.size()}") -return true \ No newline at end of file +return true diff --git a/src/it/rpm-reactor/rpm-jar/pom.xml b/src/it/rpm-reactor/rpm-jar/pom.xml index 41bf5658..a55599fa 100644 --- a/src/it/rpm-reactor/rpm-jar/pom.xml +++ b/src/it/rpm-reactor/rpm-jar/pom.xml @@ -10,6 +10,8 @@ UTF-8 + 1.8 + 1.8 diff --git a/src/it/rpm-reactor/rpm-war/pom.xml b/src/it/rpm-reactor/rpm-war/pom.xml index aff3899f..784f0ea8 100644 --- a/src/it/rpm-reactor/rpm-war/pom.xml +++ b/src/it/rpm-reactor/rpm-war/pom.xml @@ -19,4 +19,16 @@ 1.0 + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + + diff --git a/src/it/rpm-sign-with-keyname-lookup/pom.xml b/src/it/rpm-sign-with-keyname-lookup/pom.xml index 9fd052a8..b3d43067 100644 --- a/src/it/rpm-sign-with-keyname-lookup/pom.xml +++ b/src/it/rpm-sign-with-keyname-lookup/pom.xml @@ -27,6 +27,8 @@ UTF-8 + 1.8 + 1.8 true diff --git a/src/main/java/org/codehaus/mojo/rpm/AbstractRPMMojo.java b/src/main/java/org/codehaus/mojo/rpm/AbstractRPMMojo.java index 1a69d094..ac074d7c 100644 --- a/src/main/java/org/codehaus/mojo/rpm/AbstractRPMMojo.java +++ b/src/main/java/org/codehaus/mojo/rpm/AbstractRPMMojo.java @@ -45,10 +45,10 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; +import org.apache.maven.shared.filtering.FilterWrapper; import org.apache.maven.shared.filtering.MavenFileFilter; import org.apache.maven.shared.filtering.MavenFilteringException; import org.apache.maven.shared.filtering.MavenResourcesExecution; -import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; import org.codehaus.mojo.rpm.VersionHelper.RPMVersionableMojo; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.Os; @@ -107,8 +107,8 @@ public abstract class AbstractRPMMojo *

* For passivity purposes, a value of true or false will indicate whether the architecture - * of the build machine will be used. Any other value (such as x86_64) will set the architecture of the rpm - * to x86_64. + * of the build machine will be used. Any other value (such as {@code x86_64}) will set the architecture of the rpm + * to {@code x86_64}. *

*

* This can also be used in conjunction with Source @@ -702,7 +702,7 @@ public abstract class AbstractRPMMojo private RPMHelper helper; /** - * The {@link FileUtils.FilterWrapper filter wrappers} to use for file filtering. + * The {@link FilterWrapper filter wrappers} to use for file filtering. * * @since 2.0 * @see #mavenFileFilter @@ -822,7 +822,7 @@ protected void afterExecution() } /** - * Provides an opportunity for subclasses to provide an additional classifier for the rpm workarea.
+ * Provides an opportunity for subclasses to provide an additional classifier for the rpm workarea.
* By default this implementation returns {@code null}, which indicates that no additional classifier should be * used. * @@ -837,7 +837,7 @@ String getClassifier() /** * Returns the generated rpm {@link File}. * - * @return The generated rpm File. + * @return The generated rpm {@link File}. */ protected File getRPMFile() { @@ -1543,7 +1543,7 @@ final File getRPMBuildroot() } /** - * @inheritDoc + * {@inheritDoc} */ public final String getVersion() { diff --git a/src/main/java/org/codehaus/mojo/rpm/BaseTrigger.java b/src/main/java/org/codehaus/mojo/rpm/BaseTrigger.java index 1b94b9ba..9f4b1284 100644 --- a/src/main/java/org/codehaus/mojo/rpm/BaseTrigger.java +++ b/src/main/java/org/codehaus/mojo/rpm/BaseTrigger.java @@ -19,6 +19,7 @@ * under the License. */ +import org.apache.maven.shared.filtering.FilterWrapper; import org.apache.maven.shared.utils.io.FileUtils; import java.io.IOException; @@ -90,13 +91,13 @@ protected String buildScriptletLine( String directive ) } /** - * Writes the complete trigger directive. Use instead of {@link #write(PrintWriter, String)}. + * Writes the complete trigger directive. Use instead of {@link #write(PrintWriter, String, List)}. * * @param writer {@code PrintWriter} to write the trigger directive to. * @param filterWrappers The filter wrappers to be applied when writing the content. - * @throws IOException + * @throws IOException if an I/IO error occurs */ - protected void writeTrigger( PrintWriter writer, final List filterWrappers ) + protected void writeTrigger( PrintWriter writer, final List filterWrappers ) throws IOException { write( writer, getDirective(), filterWrappers ); diff --git a/src/main/java/org/codehaus/mojo/rpm/Dependency.java b/src/main/java/org/codehaus/mojo/rpm/Dependency.java index 5d455a93..87999c39 100644 --- a/src/main/java/org/codehaus/mojo/rpm/Dependency.java +++ b/src/main/java/org/codehaus/mojo/rpm/Dependency.java @@ -114,7 +114,7 @@ public boolean getStripVersion() /** * Set the stripVersion property * - * @param stripVersion + * @param stripVersion the stripVersion property to set * @throws MojoExecutionException if the parse fails */ public void setStripVersion( boolean stripVersion ) diff --git a/src/main/java/org/codehaus/mojo/rpm/FilteringDirectoryArchiver.java b/src/main/java/org/codehaus/mojo/rpm/FilteringDirectoryArchiver.java index 1418e8ef..f6069ef5 100644 --- a/src/main/java/org/codehaus/mojo/rpm/FilteringDirectoryArchiver.java +++ b/src/main/java/org/codehaus/mojo/rpm/FilteringDirectoryArchiver.java @@ -23,9 +23,9 @@ import java.io.IOException; import java.util.List; +import org.apache.maven.shared.filtering.FilterWrapper; import org.apache.maven.shared.filtering.MavenFileFilter; import org.apache.maven.shared.filtering.MavenFilteringException; -import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; import org.codehaus.plexus.archiver.ArchiveEntry; import org.codehaus.plexus.archiver.dir.DirectoryArchiver; import org.codehaus.plexus.archiver.util.ArchiveEntryUtils; diff --git a/src/main/java/org/codehaus/mojo/rpm/Mapping.java b/src/main/java/org/codehaus/mojo/rpm/Mapping.java index 9b1798e0..b7b1c9da 100644 --- a/src/main/java/org/codehaus/mojo/rpm/Mapping.java +++ b/src/main/java/org/codehaus/mojo/rpm/Mapping.java @@ -148,7 +148,7 @@ public void setDirectory( String dir ) /** * Returns if the {@link #getDirectory()} should be used for the {@link #getAttrString(String, String, String, String) * attribute string} (if and only if {@link #getSources() sources} make up everything that gets copied to the - * directory).
+ * directory).
* By default, this returns true. * * @return Whether the {@link #getDirectory()} should be used for the {@link #getAttrString(String, String, String, String) @@ -162,7 +162,7 @@ public boolean isDirectoryIncluded() /** * Sets if the {@link #getDirectory()} should be used for the {@link #getAttrString(String, String, String, String) * attribute string} (if and only if {@link #getSources() sources} make up everything that gets copied to the - * directory).
+ * directory).
* By default, this is true. * * @param directoryIncluded The {@link #directoryIncluded} to set. diff --git a/src/main/java/org/codehaus/mojo/rpm/Scriptlet.java b/src/main/java/org/codehaus/mojo/rpm/Scriptlet.java index 9a44f575..c2f73113 100644 --- a/src/main/java/org/codehaus/mojo/rpm/Scriptlet.java +++ b/src/main/java/org/codehaus/mojo/rpm/Scriptlet.java @@ -19,6 +19,7 @@ * under the License. */ +import org.apache.maven.shared.filtering.FilterWrapper; import org.apache.maven.shared.utils.io.FileUtils; import java.io.*; @@ -69,7 +70,7 @@ public class Scriptlet private String fileEncoding; /** - * The default encoding of the project, used if {@link fileEncoding} is not set. + * The default encoding of the project, used if {@link #fileEncoding} is not set. * * @see #getFileEncoding(). */ @@ -209,9 +210,9 @@ public void setFilter( boolean filter ) * @param writer {@code PrintWriter} to write content to. * @param directive The directive for the scriptlet. * @param filterWrappers The filter wrappers to be applied when writing the content. - * @throws IOException + * @throws IOException if an I/IO error occurs */ - protected final void write( final PrintWriter writer, final String directive, final List filterWrappers) + protected final void write( final PrintWriter writer, final String directive, final List filterWrappers) throws IOException { if ( scriptFile != null && !scriptFile.exists() ) @@ -260,9 +261,9 @@ protected String buildScriptletLine( final String directive ) * * @param writer {@code PrintWriter} to write content to. * @param filterWrappers The filter wrappers to be applied when writing the content. - * @throws IOException + * @throws IOException if an I/IO error occurs */ - protected final void writeContent( PrintWriter writer, final List filterWrappers ) + protected final void writeContent( PrintWriter writer, final List filterWrappers ) throws IOException { if ( script != null ) @@ -276,7 +277,7 @@ else if ( scriptFile.exists() ) : new FileReader( scriptFile ); if(filter) { - for ( FileUtils.FilterWrapper filterWrapper : filterWrappers ) { + for ( FilterWrapper filterWrapper : filterWrappers ) { reader = filterWrapper.getReader( reader ); } } diff --git a/src/main/java/org/codehaus/mojo/rpm/SoftlinkSource.java b/src/main/java/org/codehaus/mojo/rpm/SoftlinkSource.java index f311ea23..c644b438 100644 --- a/src/main/java/org/codehaus/mojo/rpm/SoftlinkSource.java +++ b/src/main/java/org/codehaus/mojo/rpm/SoftlinkSource.java @@ -20,7 +20,7 @@ */ /** - * A Source that simply indicates that the {@link Source#getLocation()} is to be linked to the + * A {@link Source} that simply indicates that the {@link Source#getLocation()} is to be linked to the * {@link Mapping#getDirectory()}. * * @author Brett Okken Cerner Corp. diff --git a/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java b/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java index b4f58dbb..ad543737 100644 --- a/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java +++ b/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java @@ -239,7 +239,8 @@ private void writeFiles() scanner.setExcludes( null ); scanner.scan(); - final boolean noFiles = map.getSources().isEmpty() || (scanner.isEverythingIncluded() && links.isEmpty()); + final boolean noFiles = map.getSources() == null || map.getSources().isEmpty() + || (scanner.isEverythingIncluded() && links.isEmpty()); if ( noFiles && map.isDirectoryIncluded() && !map.isRecurseDirectories() ) { log.debug( "writing attribute string for directory: " + destination );