From 98bc53bdff6d574217c5803b03bc9288dd9741ff986b82f52fbe5b883d3ffb5f Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Thu, 21 Mar 2019 17:23:54 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/maven?expand=0&rev=1 --- .gitattributes | 23 + .gitignore | 1 + 0001-Adapt-mvn-script.patch | 69 +++ 0002-Invoke-logback-via-reflection.patch | 53 +++ ...rt-MNG-6335-Update-Mockito-to-2.12.0.patch | 180 ++++++++ apache-maven-3.5.4-src.tar.gz | 3 + apache-maven-build.tar.xz | 3 + maven-bash-completion | 90 ++++ maven-script | 52 +++ maven.spec | 394 ++++++++++++++++++ mvn.1 | 153 +++++++ 11 files changed, 1021 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Adapt-mvn-script.patch create mode 100644 0002-Invoke-logback-via-reflection.patch create mode 100644 0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch create mode 100644 apache-maven-3.5.4-src.tar.gz create mode 100644 apache-maven-build.tar.xz create mode 100644 maven-bash-completion create mode 100644 maven-script create mode 100644 maven.spec create mode 100644 mvn.1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Adapt-mvn-script.patch b/0001-Adapt-mvn-script.patch new file mode 100644 index 0000000..e8625cf --- /dev/null +++ b/0001-Adapt-mvn-script.patch @@ -0,0 +1,69 @@ +From 46041685a82b861bc8616bb603e341adb740a302 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Wed, 1 Feb 2017 14:54:26 +0100 +Subject: [PATCH 1/3] Adapt mvn script + +--- + apache-maven/src/bin/mvn | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn +index a554c66..818cf70 100755 +--- a/apache-maven/src/bin/mvn ++++ b/apache-maven/src/bin/mvn +@@ -22,7 +22,7 @@ + # + # Environment Variable Prerequisites + # +-# JAVA_HOME Must point at your Java Development Kit installation. ++# JAVA_HOME (Optional) Must point at your Java Development Kit installation. + # MAVEN_OPTS (Optional) Java runtime options used when Maven is executed. + # MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files. + # ----------------------------------------------------------------------------- +@@ -33,12 +33,24 @@ if [ -z "$MAVEN_SKIP_RC" ] ; then + . /etc/mavenrc + fi + ++ if [ -f /etc/java/maven.conf ] ; then ++ . /etc/java/maven.conf ++ fi ++ + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + + fi + ++if [ -f /usr/share/java-utils/java-functions ] ; then ++ . /usr/share/java-utils/java-functions ++ set_jvm ++ set_javacmd ++fi ++export JAVA_HOME ++export JAVACMD ++ + # OS specific support. $var _must_ be set to either true or false. + cygwin=false; + mingw=false; +@@ -63,7 +75,8 @@ done + + saveddir=`pwd` + +-MAVEN_HOME=`dirname "$PRG"`/.. ++MAVEN_HOME="${_FEDORA_MAVEN_HOME:-`dirname "$PRG"`/..}" ++unset _FEDORA_MAVEN_HOME + + # make it fully qualified + MAVEN_HOME=`cd "$MAVEN_HOME" && pwd` +@@ -102,7 +115,7 @@ if [ ! -x "$JAVACMD" ] ; then + exit 1 + fi + +-CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar` ++CLASSWORLDS_JAR=`build-classpath plexus-classworlds` + CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + + # For Cygwin, switch paths to Windows format before running java +-- +2.17.1 + diff --git a/0002-Invoke-logback-via-reflection.patch b/0002-Invoke-logback-via-reflection.patch new file mode 100644 index 0000000..5242a30 --- /dev/null +++ b/0002-Invoke-logback-via-reflection.patch @@ -0,0 +1,53 @@ +From 4e1e32e3a96c6876a22cca6743288b8c8df4adb0 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Tue, 6 Jun 2017 13:47:43 +0200 +Subject: [PATCH 2/3] Invoke logback via reflection + +--- + .../logging/impl/LogbackConfiguration.java | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +index 5d9fab7..ced38cb 100644 +--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java ++++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +@@ -35,22 +35,31 @@ public class LogbackConfiguration + @Override + public void setRootLoggerLevel( Level level ) + { +- ch.qos.logback.classic.Level value; ++ String value; + switch ( level ) + { + case DEBUG: +- value = ch.qos.logback.classic.Level.DEBUG; ++ value = "DEBUG"; + break; + + case INFO: +- value = ch.qos.logback.classic.Level.INFO; ++ value = "INFO"; + break; + + default: +- value = ch.qos.logback.classic.Level.ERROR; ++ value = "ERROR"; + break; + } +- ( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value ); ++ Logger logger = LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ); ++ try { ++ Class levelClass = Class.forName("ch.qos.logback.classic.Level"); ++ Object logbackLevel = levelClass.getField(value).get(null); ++ Class loggerClass = Class.forName("ch.qos.logback.classic.Logger"); ++ loggerClass.getMethod("setLevel", new Class[] {levelClass}) ++ .invoke(logger, new Object[] {logbackLevel}); ++ } catch (Exception e) { ++ throw new RuntimeException("Failed to initialize logback configuration", e); ++ } + } + + @Override +-- +2.17.1 + diff --git a/0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch b/0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch new file mode 100644 index 0000000..529ae23 --- /dev/null +++ b/0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch @@ -0,0 +1,180 @@ +From 6b5e263ebd03be9551c4e6aa394ac2334fff7c03 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Tue, 13 Mar 2018 11:49:16 +0100 +Subject: [PATCH 3/3] Revert "[ MNG-6335] Update Mockito to 2.12.0" + +This reverts commit a03489b67d04a4b014ff5d1c151b331a39bf100b. +--- + .../DefaultToolchainManagerPrivateTest.java | 15 +++++++++------ + .../toolchain/DefaultToolchainManagerTest.java | 4 ++-- + .../building/DefaultToolchainsBuilderTest.java | 14 +++++++------- + maven-embedder/pom.xml | 1 - + pom.xml | 2 +- + 5 files changed, 19 insertions(+), 17 deletions(-) + +diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java +index c937564..1e48441 100644 +--- a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java ++++ b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java +@@ -20,7 +20,8 @@ package org.apache.maven.toolchain; + */ + + import static org.junit.Assert.assertEquals; +-import static org.mockito.ArgumentMatchers.anyString; ++import static org.junit.Assert.fail; ++import static org.mockito.Matchers.anyString; + import static org.mockito.Mockito.mock; + import static org.mockito.Mockito.never; + import static org.mockito.Mockito.verify; +@@ -144,8 +145,9 @@ public class DefaultToolchainManagerPrivateTest + verify( logger, never() ).error( anyString() ); + assertEquals( 2, toolchains.length ); + } +- +- @Test ++ ++ @SuppressWarnings( "unchecked" ) ++ @Test( expected = MisconfiguredToolchainException.class ) + public void testMisconfiguredToolchain() + throws Exception + { +@@ -153,11 +155,12 @@ public class DefaultToolchainManagerPrivateTest + MavenSession session = mock( MavenSession.class ); + MavenExecutionRequest req = new DefaultMavenExecutionRequest(); + when( session.getRequest() ).thenReturn( req ); ++ when(toolchainFactory_basicType.createDefaultToolchain()).thenThrow( MisconfiguredToolchainException.class ); + + // execute +- ToolchainPrivate[] basics = toolchainManager.getToolchainsForType("basic", session); +- ++ toolchainManager.getToolchainsForType( "basic", session ); ++ + // verify +- assertEquals( 0, basics.length ); ++ fail( "Should exit with a MisconfiguredToolchainException" ); + } + } +diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java +index 84444c0..6e85c42 100644 +--- a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java ++++ b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java +@@ -20,6 +20,7 @@ package org.apache.maven.toolchain; + */ + + import static org.junit.Assert.assertEquals; ++import static org.mockito.Matchers.anyMap; + import static org.mockito.Matchers.isA; + import static org.mockito.Mockito.mock; + import static org.mockito.Mockito.verify; +@@ -38,7 +39,6 @@ import org.apache.maven.toolchain.model.ToolchainModel; + import org.codehaus.plexus.logging.Logger; + import org.junit.Before; + import org.junit.Test; +-import org.mockito.ArgumentMatchers; + import org.mockito.InjectMocks; + import org.mockito.Mock; + import org.mockito.MockitoAnnotations; +@@ -142,7 +142,7 @@ public class DefaultToolchainManagerTest + executionRequest.setToolchains( toolchainModels ); + when( session.getRequest() ).thenReturn( executionRequest ); + ToolchainPrivate basicPrivate = mock( ToolchainPrivate.class ); +- when( basicPrivate.matchesRequirements( ArgumentMatchers.anyMap() ) ).thenReturn( false ).thenReturn( true ); ++ when( basicPrivate.matchesRequirements( anyMap() ) ).thenReturn( false ).thenReturn( true ); + when( toolchainFactory_basicType.createToolchain( isA( ToolchainModel.class ) ) ).thenReturn( basicPrivate ); + + List toolchains = +diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java +index fc530df..80fca09 100644 +--- a/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java ++++ b/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java +@@ -21,7 +21,8 @@ package org.apache.maven.toolchain.building; + + import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertNotNull; +-import static org.mockito.ArgumentMatchers.any; ++import static org.mockito.Matchers.any; ++import static org.mockito.Matchers.anyMap; + import static org.mockito.Mockito.when; + + import java.io.IOException; +@@ -34,7 +35,6 @@ import org.apache.maven.toolchain.model.PersistedToolchains; + import org.apache.maven.toolchain.model.ToolchainModel; + import org.junit.Before; + import org.junit.Test; +-import org.mockito.ArgumentMatchers; + import org.mockito.InjectMocks; + import org.mockito.Mock; + import org.mockito.MockitoAnnotations; +@@ -78,7 +78,7 @@ public class DefaultToolchainsBuilderTest + toolchain.setType( "TYPE" ); + toolchain.addProvide( "key", "user_value" ); + userResult.addToolchain( toolchain ); +- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.anyMap()) ).thenReturn( userResult ); ++ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( userResult ); + + ToolchainsBuildingResult result = toolchainBuilder.build( request ); + assertNotNull( result.getEffectiveToolchains() ); +@@ -101,7 +101,7 @@ public class DefaultToolchainsBuilderTest + toolchain.setType( "TYPE" ); + toolchain.addProvide( "key", "global_value" ); + globalResult.addToolchain( toolchain ); +- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.anyMap()) ).thenReturn( globalResult ); ++ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( globalResult ); + + ToolchainsBuildingResult result = toolchainBuilder.build( request ); + assertNotNull( result.getEffectiveToolchains() ); +@@ -131,7 +131,7 @@ public class DefaultToolchainsBuilderTest + globalToolchain.setType( "TYPE" ); + globalToolchain.addProvide( "key", "global_value" ); + globalResult.addToolchain( globalToolchain ); +- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.anyMap()) ).thenReturn( globalResult ).thenReturn( userResult ); ++ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( globalResult ).thenReturn( userResult ); + + ToolchainsBuildingResult result = toolchainBuilder.build( request ); + assertNotNull( result.getEffectiveToolchains() ); +@@ -150,7 +150,7 @@ public class DefaultToolchainsBuilderTest + ToolchainsBuildingRequest request = new DefaultToolchainsBuildingRequest(); + request.setGlobalToolchainsSource( new StringSource( "" ) ); + ToolchainsParseException parseException = new ToolchainsParseException( "MESSAGE", 4, 2 ); +- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.anyMap()) ).thenThrow( parseException ); ++ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenThrow( parseException ); + + try + { +@@ -169,7 +169,7 @@ public class DefaultToolchainsBuilderTest + ToolchainsBuildingRequest request = new DefaultToolchainsBuildingRequest(); + request.setGlobalToolchainsSource( new StringSource( "", "LOCATION" ) ); + IOException ioException = new IOException( "MESSAGE" ); +- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.anyMap()) ).thenThrow( ioException ); ++ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenThrow( ioException ); + + try + { +diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml +index 8a00565..2a9668b 100644 +--- a/maven-embedder/pom.xml ++++ b/maven-embedder/pom.xml +@@ -141,7 +141,6 @@ under the License. + + org.mockito + mockito-core +- test + + + org.fusesource.jansi +diff --git a/pom.xml b/pom.xml +index ef1d0b0..77b3395 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -53,7 +53,7 @@ under the License. + 1.4 + 3.5 + 4.12 +- 2.12.0 ++ 1.10.19 + 1.7.1 + 1.24 + 3.1.0 +-- +2.17.1 + diff --git a/apache-maven-3.5.4-src.tar.gz b/apache-maven-3.5.4-src.tar.gz new file mode 100644 index 0000000..7726141 --- /dev/null +++ b/apache-maven-3.5.4-src.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3ba1f1b24bbd4c345174ac616d40e26e72dad6022d56317d3ff6f7dd003e2f5 +size 2682134 diff --git a/apache-maven-build.tar.xz b/apache-maven-build.tar.xz new file mode 100644 index 0000000..629983d --- /dev/null +++ b/apache-maven-build.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d9a5e5cee4065515a18ae5c56b440731f8443e1919c45ad707ac9c0831f353d +size 4836 diff --git a/maven-bash-completion b/maven-bash-completion new file mode 100644 index 0000000..d1aa9db --- /dev/null +++ b/maven-bash-completion @@ -0,0 +1,90 @@ +_m2_make_goals() +{ + plugin=$1 + mojos=$2 + for mojo in $mojos + do + export goals="$goals $plugin:$mojo" + done +} + +_m2_complete() +{ + local cur goals + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + case "${prev}" in + -f | --file|-l|--log-file) + COMPREPLY=( $(compgen -f ${cur}) ) + return 0 + ;; + *);; + esac + + + goals='clean compile test install package deploy site verify' + if [[ ${cur} == -* ]] ; then + goals="$goals -am --also-make + -amd --also-make-dependents + -B --batch-mode + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -h --help + -l --log-file + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -T --threads + -t --toolchains + -U --update-snapshots + -up --update-plugins + -V --show-version + -v --version + -X --debug + -Dmaven.test.skip=true + -Dmaven.compiler.source=1.5 + -Dmaven.compiler.source=1.6 + -Dmaven.compiler.source=1.7 + -Dmaven.compiler.target=1.5 + -Dmaven.compiler.target=1.6 + -Dmaven.compiler.target=1.7 + -Dproject.build.sourceEncoding=UTF-8 + -Dmaven.repo.local= + -Dmaven.local.depmap.file= + -Dmaven.local.debug=true + -Dmaven.local.mode=true" + fi + + goals=$goals _m2_make_goals "eclipse" "eclipse" + goals=$goals _m2_make_goals "idea" "idea" + goals=$goals _m2_make_goals "assembly" "assembly" + goals=$goals _m2_make_goals "plexus" "app bundle-application bundle-runtime descriptor runtime service" + goals=$goals _m2_make_goals "dependency" "analyze analyze-dep-mgt analyze-only analyze-report analyze-duplicate + build-classpath copy copy-dependencies get go-offline list properties + purge-local-repository resolve resolve-plugins sources tree unpack + unpack-dependencies" + cur=`echo $cur | sed 's/\\\\//g'` + COMPREPLY=($(compgen -W "${goals}" -- ${cur} | sed 's/\\\\//g') ) +} + +complete -F _m2_complete -o filenames mvn diff --git a/maven-script b/maven-script new file mode 100644 index 0000000..213bec4 --- /dev/null +++ b/maven-script @@ -0,0 +1,52 @@ +#!/bin/sh + +for f in /etc/mavenrc /etc/java/maven.conf "$HOME/.mavenrc"; do + [ -f "$f" ] && . "$f" +done + +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions + set_jvm + set_javacmd +fi +export JAVA_HOME +export JAVACMD + +export M2_HOME="${M2_HOME:-/usr/share/maven}" + + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { +( + basedir="`pwd`" + wdir="`pwd`" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir="`cd "$wdir/.."; pwd`" + done + echo "${basedir}" +) +} + +export MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}" + +export MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" + +project_opts=$( + [ -e "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config" ] && + cat /tmp/foo "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") + +exec "$JAVACMD" \ + $project_opts \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath $(build-classpath plexus-classworlds) \ + -Dclassworlds.conf="${M2_HOME}/bin/m2.conf" \ + -Dmaven.home="${M2_HOME}" \ + -Dmaven.multiModuleProjectDirectory="${MAVEN_PROJECTBASEDIR}" \ + org.codehaus.plexus.classworlds.launcher.Launcher \ + "$@" diff --git a/maven.spec b/maven.spec new file mode 100644 index 0000000..91b57a1 --- /dev/null +++ b/maven.spec @@ -0,0 +1,394 @@ +# +# spec file for package maven +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global bundled_slf4j_version 1.7.25 +%global homedir %{_datadir}/%{name}%{?maven_version_suffix} +%global confdir %{_sysconfdir}/%{name}%{?maven_version_suffix} +%bcond_with logback +Name: maven +Version: 3.5.4 +Release: 0 +Summary: Java project management and project comprehension tool +# maven itself is ASL 2.0 +# bundled slf4j is MIT +License: Apache-2.0 AND MIT +Group: Development/Tools/Building +URL: http://maven.apache.org/ +Source0: http://archive.apache.org/dist/%{name}/%{name}-3/%{version}/source/apache-%{name}-%{version}-src.tar.gz +Source1: maven-bash-completion +Source2: mvn.1 +Source10: apache-%{name}-build.tar.xz +Patch1: 0001-Adapt-mvn-script.patch +# Downstream-specific, avoids dependency on logback +# Used only when %%without logback is in effect +Patch2: 0002-Invoke-logback-via-reflection.patch +# We don't have mockito 2 yet +Patch3: 0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch +BuildRequires: ant +BuildRequires: apache-commons-cli +BuildRequires: apache-commons-codec +BuildRequires: apache-commons-io +BuildRequires: apache-commons-lang3 +BuildRequires: apache-commons-logging +BuildRequires: atinject +BuildRequires: cdi-api +BuildRequires: dos2unix +BuildRequires: fdupes +BuildRequires: geronimo-annotation-1_0-api +BuildRequires: google-guice +BuildRequires: guava20 +BuildRequires: hawtjni-runtime +BuildRequires: httpcomponents-client +BuildRequires: httpcomponents-core +BuildRequires: jansi +BuildRequires: jansi-native +BuildRequires: javapackages-local +BuildRequires: jcl-over-slf4j +BuildRequires: jdom2 +BuildRequires: maven-resolver-api +BuildRequires: maven-resolver-connector-basic +BuildRequires: maven-resolver-impl +BuildRequires: maven-resolver-spi +BuildRequires: maven-resolver-transport-wagon +BuildRequires: maven-resolver-util +BuildRequires: maven-shared-utils +BuildRequires: maven-wagon-file +BuildRequires: maven-wagon-http +BuildRequires: maven-wagon-http-shared +BuildRequires: maven-wagon-provider-api +BuildRequires: modello +BuildRequires: objectweb-asm +BuildRequires: plexus-cipher +BuildRequires: plexus-classworlds +BuildRequires: plexus-cli +BuildRequires: plexus-containers-component-annotations +BuildRequires: plexus-interpolation +BuildRequires: plexus-metadata-generator +BuildRequires: plexus-sec-dispatcher +BuildRequires: plexus-utils +BuildRequires: qdox +BuildRequires: sisu-inject +BuildRequires: sisu-plexus +BuildRequires: slf4j +BuildRequires: slf4j-sources +BuildRequires: unix2dos +BuildRequires: xbean +BuildRequires: xmvn-install +BuildRequires: xmvn-resolve xmvn-subst +BuildRequires: mvn(org.apache.maven:maven-parent:pom:) +Requires: %{name}-lib = %{version}-%{release} +Requires(post): aaa_base +Requires(postun): aaa_base +# maven-lib cannot be noarch because of the position of jansi-native.jar +#BuildArch: noarch +%if %{with logback} +BuildRequires: mvn(ch.qos.logback:logback-classic) +%endif + +%description +Maven is a software project management and comprehension tool. Based on the +concept of a project object model (POM), Maven can manage a project's build, +reporting and documentation from a central piece of information. + +%package lib +Summary: Core part of Maven +# Require full javapackages-tools since maven-script uses +# /usr/share/java-utils/java-functions +# XMvn does generate auto-requires, but explicit requires are still +# needed because some symlinked JARs are not present in Maven POMs or +# their dependency scope prevents them from being added automatically +# by XMvn. It would be possible to explicitly specify only +# dependencies which are not generated automatically, but adding +# everything seems to be easier. +Group: Development/Tools/Building +Requires: aopalliance +Requires: apache-commons-cli +Requires: apache-commons-codec +Requires: apache-commons-io +Requires: apache-commons-lang3 +Requires: apache-commons-logging +Requires: atinject +Requires: cdi-api +Requires: cglib +Requires: geronimo-annotation-1_0-api +Requires: google-guice +Requires: guava20 +Requires: hawtjni-runtime +Requires: httpcomponents-client +Requires: httpcomponents-core +Requires: jansi +Requires: jansi-native +Requires: javapackages-tools +Requires: jcl-over-slf4j +Requires: junit +Requires: maven-resolver-api +Requires: maven-resolver-connector-basic +Requires: maven-resolver-impl +Requires: maven-resolver-spi +Requires: maven-resolver-transport-wagon +Requires: maven-resolver-util +Requires: maven-shared-utils +Requires: maven-wagon-file +Requires: maven-wagon-http +Requires: maven-wagon-http-shared +Requires: maven-wagon-provider-api +Requires: objectweb-asm +Requires: plexus-cipher +Requires: plexus-classworlds +Requires: plexus-containers-component-annotations +Requires: plexus-interpolation +Requires: plexus-sec-dispatcher +Requires: plexus-utils +Requires: sisu-inject +Requires: sisu-plexus +Requires: slf4j +# Maven upstream uses patched version of SLF4J. They unpack +# slf4j-simple-sources.jar, apply non-upstreamable, Maven-specific +# patch (using a script written in Groovy), compile and package as +# maven-slf4j-provider.jar, together with Maven-specific additions. +Provides: bundled(slf4j) = %{bundled_slf4j_version} +# If XMvn is part of the same RPM transaction then it should be +# installed first to avoid triggering rhbz#1014355. +OrderWithRequires: xmvn-minimal + +%description lib +Core part of Apache Maven that can be used as a library. + +%package javadoc +Summary: API documentation for %{name} +Group: Development/Tools/Building +BuildArch: noarch + +%description javadoc +%{summary}. + +%prep +%setup -q -n apache-%{name}-%{version} -a10 + +%patch1 -p1 +%patch3 -p1 + +# not really used during build, but a precaution +find -name '*.jar' -not -path '*/test/*' -delete +find -name '*.class' -delete +find -name '*.bat' -delete + +sed -i 's:\r::' apache-maven/src/conf/settings.xml + +# Downloads dependency licenses from the Internet and aggregates them. +# We already ship the licenses in their respective packages. +rm apache-maven/src/main/appended-resources/META-INF/LICENSE.vm + +# Disable plugins which are not useful for us +%pom_remove_plugin -r :animal-sniffer-maven-plugin +%pom_remove_plugin -r :apache-rat-plugin +%pom_remove_plugin -r :maven-site-plugin +%pom_remove_plugin -r :buildnumber-maven-plugin +sed -i " +/buildNumber=/ { + s/=.*/=SUSE %{version}-%{release}/ +} +/timestamp=/ d +" `find -name build.properties` +sed -i "s/version=.*/version=%{version}/" `find -name build.properties` +sed -i "s/distributionId=.*/distributionId=apache-maven/" `find -name build.properties` +sed -i "s/distributionShortName=.*/distributionShortName=Maven/" `find -name build.properties` +sed -i "s/distributionName=.*/distributionName=Apache\ Maven/" `find -name build.properties` + +%{mvn_package} :apache-maven __noinstall + +%if %{without logback} +%pom_remove_dep -r :logback-classic +%patch2 -p1 +%endif + +%{mvn_alias} :maven-resolver-provider :maven-aether-provider + +# xmvn depends on this version, so we want to avoid duplicate apache-commons-lang3 jars in xmvn +%pom_xpath_set pom:project/pom:properties/pom:commonsLangVersion "3.8.1" + +%build +mkdir -p lib +build-jar-repository -s lib \ + apache-commons-lang3 \ + atinject \ + commons-cli \ + commons-io \ + guava20/guava-10.0 \ + guice/google-guice-no_aop \ + jdom2/jdom2 \ + maven-resolver/maven-resolver-api \ + maven-resolver/maven-resolver-impl \ + maven-resolver/maven-resolver-spi \ + maven-resolver/maven-resolver-util \ + maven-shared-utils/maven-shared-utils \ + maven-wagon/provider-api \ + objectweb-asm/asm-commons \ + objectweb-asm/asm \ + org.eclipse.sisu.inject \ + org.eclipse.sisu.plexus \ + plexus-classworlds \ + plexus/cli \ + plexus-containers/plexus-component-annotations \ + plexus/interpolation \ + plexus-metadata-generator \ + plexus/plexus-cipher \ + plexus/plexus-sec-dispatcher \ + plexus/utils \ + qdox \ + slf4j/api \ + slf4j/simple \ + xbean/xbean-reflect +ln -s $(build-classpath slf4j/slf4j-simple-sources) lib/ +%ant \ + -Dtest.skip=true \ + package javadoc + +%{mvn_artifact} pom.xml +mkdir -p target/site/apidocs +for i in \ + artifact \ + model \ + plugin-api \ + builder-support \ + model-builder \ + settings \ + settings-builder \ + repository-metadata \ + resolver-provider \ + core \ + slf4j-provider \ + embedder \ + compat; do + cp -r %{name}-${i}/target/site/apidocs target/site/apidocs/%{name}-${i} + %{mvn_artifact} %{name}-${i}/pom.xml %{name}-${i}/target/%{name}-${i}-%{version}.jar +done + +%install +%mvn_install +%fdupes %{buildroot}%{_javadocdir} + +install -d -m 755 %{buildroot}%{homedir}/boot +install -d -m 755 %{buildroot}%{confdir} +install -d -m 755 %{buildroot}%{_datadir}/bash-completion/completions/ + +cp -a apache-maven/src/{bin,conf,lib} %{buildroot}%{homedir}/ +chmod +x %{buildroot}%{homedir}/bin/* +unix2dos %{buildroot}%{homedir}/bin/*.cmd %{buildroot}%{homedir}/bin/*.conf +chmod -x %{buildroot}%{homedir}/bin/*.cmd %{buildroot}%{homedir}/bin/*.conf + +# Transitive deps of wagon-http, missing because of unshading +build-jar-repository -p %{buildroot}%{homedir}/lib \ + aopalliance \ + objectweb-asm/asm \ + cdi-api/cdi-api \ + cglib/cglib \ + commons-cli \ + commons-codec \ + commons-io \ + apache-commons-lang3 \ + commons-logging \ + guava20/guava-10.0 \ + guice/google-guice-no_aop \ + hamcrest/core \ + hawtjni/hawtjni-runtime \ + httpcomponents/httpclient \ + httpcomponents/httpcore \ + jansi/jansi \ + jansi-native/jansi-linux \ + jansi-native/jansi-native \ + atinject \ + slf4j/jcl-over-slf4j \ + geronimo-annotation-1.0-api \ + junit \ + maven-resolver/maven-resolver-api \ + maven-resolver/maven-resolver-connector-basic \ + maven-resolver/maven-resolver-impl \ + maven-resolver/maven-resolver-spi \ + maven-resolver/maven-resolver-transport-wagon \ + maven-resolver/maven-resolver-util \ + maven-shared-utils/maven-shared-utils \ + maven-wagon/http-shared \ + org.eclipse.sisu.inject \ + org.eclipse.sisu.plexus \ + plexus/plexus-cipher \ + plexus-containers/plexus-component-annotations \ + plexus/interpolation \ + plexus/plexus-sec-dispatcher \ + plexus/utils \ + slf4j/api \ + slf4j/simple \ + maven-wagon/file \ + maven-wagon/http \ + maven-wagon/provider-api + +cp %{buildroot}%{_javadir}/%{name}/*.jar %{buildroot}%{homedir}/lib/ + +build-jar-repository -p %{buildroot}%{homedir}/boot \ + plexus-classworlds + +xmvn-subst -R %{buildroot} -s %{buildroot}%{homedir} + +install -p -m 644 %{SOURCE2} %{buildroot}%{homedir}/bin/ +gzip -9 %{buildroot}%{homedir}/bin/mvn.1 +install -p -m 644 %{SOURCE1} %{buildroot}%{_datadir}/bash-completion/completions/mvn%{?maven_version_suffix} +mv %{buildroot}%{homedir}/bin/m2.conf %{buildroot}%{_sysconfdir}/m2%{?maven_version_suffix}.conf +ln -sf %{_sysconfdir}/m2%{?maven_version_suffix}.conf %{buildroot}%{homedir}/bin/m2.conf +mv %{buildroot}%{homedir}/conf/settings.xml %{buildroot}%{confdir}/ +ln -sf %{confdir}/settings.xml %{buildroot}%{homedir}/conf/settings.xml +mv %{buildroot}%{homedir}/conf/logging %{buildroot}%{confdir}/ +ln -sf %{confdir}/logging %{buildroot}%{homedir}/conf + +# Ghosts for alternatives +install -d -m 755 %{buildroot}%{_bindir}/ +install -d -m 755 %{buildroot}%{_mandir}/man1/ +touch %{buildroot}%{_bindir}/{mvn,mvnDebug} +touch %{buildroot}%{_mandir}/man1/{mvn,mvnDebug}.1 + +%post +update-alternatives --install %{_bindir}/mvn mvn %{homedir}/bin/mvn %{?maven_alternatives_priority}0 \ +--slave %{_bindir}/mvnDebug mvnDebug %{homedir}/bin/mvnDebug \ +--slave %{_mandir}/man1/mvn.1.gz mvn1 %{homedir}/bin/mvn.1.gz \ +--slave %{_mandir}/man1/mvnDebug.1.gz mvnDebug1 %{homedir}/bin/mvn.1.gz \ + +%postun +if [[ $1 -eq 0 ]]; then + update-alternatives --remove %{name} %{homedir}/bin/mvn +fi + +%files lib -f .mfiles +%doc README.md +%license LICENSE NOTICE +%{homedir} +%dir %{confdir} +%dir %{confdir}/logging +%config(noreplace) %{_sysconfdir}/m2%{?maven_version_suffix}.conf +%config(noreplace) %{confdir}/settings.xml +%config(noreplace) %{confdir}/logging/simplelogger.properties + +%files +%ghost %{_bindir}/mvn +%ghost %{_bindir}/mvnDebug +%{_datadir}/bash-completion +%ghost %{_mandir}/man1/mvn.1.gz +%ghost %{_mandir}/man1/mvnDebug.1.gz + +%files javadoc -f .mfiles-javadoc +%license LICENSE NOTICE + +%changelog diff --git a/mvn.1 b/mvn.1 new file mode 100644 index 0000000..9016fbd --- /dev/null +++ b/mvn.1 @@ -0,0 +1,153 @@ +.TH MVN "1" "April 2015" "Apache Maven 3.3.1" "User Commands" +.SH NAME +mvn \- software project management and comprehension tool +.SH DESCRIPTION +usage: mvn [options] [] [] +usage: mvnDebug [options] [] [] +.SH OPTIONS +.TP +\fB\-am\fR,\-\-also\-make +If project list is specified, also +build projects required by the +list +.TP +\fB\-amd\fR,\-\-also\-make\-dependents +If project list is specified, also +build projects that depend on +projects on the list +.TP +\fB\-B\fR,\-\-batch\-mode +Run in non\-interactive (batch) +mode +.TP +\fB\-b\fR,\-\-builder +The id of the build strategy to +use. +.TP +\fB\-C\fR,\-\-strict\-checksums +Fail the build if checksums don't +match +.TP +\fB\-c\fR,\-\-lax\-checksums +Warn if checksums don't match +.TP +\fB\-cpu\fR,\-\-check\-plugin\-updates +Ineffective, only kept for +backward compatibility +.TP +\fB\-D\fR,\-\-define +Define a system property +.TP +\fB\-e\fR,\-\-errors +Produce execution error messages +.TP +\fB\-emp\fR,\-\-encrypt\-master\-password +Encrypt master security password +.TP +\fB\-ep\fR,\-\-encrypt\-password +Encrypt server password +.TP +\fB\-f\fR,\-\-file +Force the use of an alternate POM +file (or directory with pom.xml). +.TP +\fB\-fae\fR,\-\-fail\-at\-end +Only fail the build afterwards; +allow all non\-impacted builds to +continue +.TP +\fB\-ff\fR,\-\-fail\-fast +Stop at first failure in +reactorized builds +.TP +\fB\-fn\fR,\-\-fail\-never +NEVER fail the build, regardless +of project result +.TP +\fB\-gs\fR,\-\-global\-settings +Alternate path for the global +settings file +.TP +\fB\-gt\fR,\-\-global\-toolchains +Alternate path for the global +toolchains file +.TP +\fB\-h\fR,\-\-help +Display help information +.TP +\fB\-l\fR,\-\-log\-file +Log file to where all build output +will go. +.TP +\fB\-llr\fR,\-\-legacy\-local\-repository +Use Maven 2 Legacy Local +Repository behaviour, ie no use of +_remote.repositories. Can also be +activated by using +\fB\-Dmaven\fR.legacyLocalRepo=true +.TP +\fB\-N\fR,\-\-non\-recursive +Do not recurse into sub\-projects +.TP +\fB\-npr\fR,\-\-no\-plugin\-registry +Ineffective, only kept for +backward compatibility +.TP +\fB\-npu\fR,\-\-no\-plugin\-updates +Ineffective, only kept for +backward compatibility +.TP +\fB\-nsu\fR,\-\-no\-snapshot\-updates +Suppress SNAPSHOT updates +.TP +\fB\-o\fR,\-\-offline +Work offline +.TP +\fB\-P\fR,\-\-activate\-profiles +Comma\-delimited list of profiles +to activate +.TP +\fB\-pl\fR,\-\-projects +Comma\-delimited list of specified +reactor projects to build instead +of all projects. A project can be +specified by [groupId]:artifactId +or by its relative path. +.TP +\fB\-q\fR,\-\-quiet +Quiet output \- only show errors +.TP +\fB\-rf\fR,\-\-resume\-from +Resume reactor from specified +project +.TP +\fB\-s\fR,\-\-settings +Alternate path for the user +settings file +.TP +\fB\-T\fR,\-\-threads +Thread count, for instance 2.0C +where C is core multiplied +.TP +\fB\-t\fR,\-\-toolchains +Alternate path for the user +toolchains file +.TP +\fB\-U\fR,\-\-update\-snapshots +Forces a check for missing +releases and updated snapshots on +remote repositories +.TP +\fB\-up\fR,\-\-update\-plugins +Ineffective, only kept for +backward compatibility +.TP +\fB\-V\fR,\-\-show\-version +Display version information +WITHOUT stopping build +.TP +\fB\-v\fR,\-\-version +Display version information +.TP +\fB\-X\fR,\-\-debug +Produce execution debug output