Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

[MWRAPPER-14] put all wrapper pieces in one build #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
Contributing to [Apache Maven Wrapper Plugin](https://maven.apache.org/plugins/maven-wrapper-plugin/)
Contributing to [Apache Maven Wrapper](https://maven.apache.org/wrapper/)
======================

[![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MWRAPPER.json)][jira]
Expand Down Expand Up @@ -82,7 +82,7 @@ Additional Resources
--------------------

+ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
+ [Apache Maven Artifact Resolver project page][jira]
+ [Apache Maven Wrapper project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
Expand Down
133 changes: 133 additions & 0 deletions maven-wrapper-distribution/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?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 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>
<parent>
<groupId>org.apache.maven.wrapper</groupId>
<artifactId>maven-wrapper-parent</artifactId>
<version>3.0.3-SNAPSHOT</version>
</parent>

<artifactId>maven-wrapper-distribution</artifactId>
<packaging>pom</packaging>

<name>Maven Wrapper Distribution</name>
<description>The Maven Wrapper distribution zips in 3 types: script, bin and source.</description>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<exclude>src/assembly/maven/bin/m2.conf</exclude>
<!-- these are partial scripts, resulting in mwnw scripts -->
<exclude>src/assembly/maven/init</exclude>
<exclude>src/assembly/maven/init.cmd</exclude>
<exclude>src/assembly/maven/run</exclude>
<exclude>src/assembly/maven/run.cmd</exclude>
<exclude>src/assembly/shared/mvnwlauncher</exclude>
<exclude>src/assembly/shared/mvnwlauncher.cmd</exclude>
<exclude>src/assembly/*/download</exclude>
<exclude>src/assembly/*/download.cmd</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<skip>true</skip> <!-- sharing outputDirectory with maven-dist -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/assembly/script.xml</descriptor>
<descriptor>src/assembly/bin.xml</descriptor>
<descriptor>src/assembly/source.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.maven.wrapper</groupId>
<artifactId>maven-wrapper</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>apache-release</id>
<build>
<plugins>
<!-- calculate sha512 checksums -->
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<executions>
<execution>
<id>source-release-checksum</id>
<goals>
<goal>files</goal>
</goals>
</execution>
</executions>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.artifactId}-${project.version}-bin.zip</include>
<include>${project.artifactId}-${project.version}-script.zip</include>
<include>${project.artifactId}-${project.version}-source.zip</include>
</includes>
</fileSet>
</fileSets>
<failIfNoFiles>true</failIfNoFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
85 changes: 85 additions & 0 deletions maven-wrapper-distribution/src/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?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.
-->

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.apache.maven.wrapper:maven-wrapper:jar:*</include>
</includes>
<outputDirectory>.mvn/wrapper</outputDirectory>
<outputFileNameMapping>maven-wrapper.jar</outputFileNameMapping>
</dependencySet>
</dependencySets>
<files>
<file>
<source>src/assembly/shared/mvnwDebug.cmd</source>
<outputDirectory>.</outputDirectory>
<lineEnding>dos</lineEnding>
</file>
<file>
<source>src/assembly/shared/mvnwDebug</source>
<outputDirectory>.</outputDirectory>
<lineEnding>unix</lineEnding>
<fileMode>0755</fileMode>
</file>
<file>
<sources>
<source>src/assembly/maven/validate.cmd</source>
<source>src/assembly/maven/init.cmd</source>
<source>src/assembly/shared/mvnwlauncher.cmd</source>
<source>src/assembly/maven/run.cmd</source>
</sources>
<destName>mvnw.cmd</destName>
<outputDirectory>.</outputDirectory>
<lineEnding>dos</lineEnding>
<filtered>true</filtered>
</file>
<file>
<sources>
<source>src/assembly/maven/validate</source>
<source>src/assembly/maven/init</source>
<source>src/assembly/shared/mvnwlauncher</source>
<source>src/assembly/maven/run</source>
</sources>
<destName>mvnw</destName>
<outputDirectory>.</outputDirectory>
<lineEnding>unix</lineEnding>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</file>
</files>
<fileSets>
<fileSet>
<directory>src/assembly/shared/mvn</directory>
<outputDirectory>.mvn</outputDirectory>
<filtered>true</filtered>
</fileSet>
</fileSets>
</assembly>
86 changes: 86 additions & 0 deletions maven-wrapper-distribution/src/assembly/maven/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
CLASSWORLDS_CONF="$MAVEN_HOME/bin/m2.conf"

# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"

if [ ! -x "$JAVACMD" ] ; then
echo "The JAVA_HOME environment variable is not defined correctly, so Apache Maven cannot be started." >&2
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" does not exist." >&2
exit 1
fi
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"

if [ ! -x "$JAVACMD" ] ; then
echo "The java(1) command does not exist in PATH nor is JAVA_HOME set, so Apache Maven cannot be started." >&2
exit 1
fi
fi

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
(
basedir=`find_file_argument_basedir "$@"`
wdir="$basedir"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir=`cd "$wdir/.."; pwd`
done
echo "$basedir"
)
}

find_file_argument_basedir() {
(
basedir=`pwd`

found_file_switch=0
for arg in "$@"; do
if [ ${found_file_switch} -eq 1 ]; then
if [ -d "${arg}" ]; then
basedir=`cd "${arg}" && pwd -P`
elif [ -f "${arg}" ]; then
basedir=`dirname "${arg}"`
basedir=`cd "$basedir" && pwd -P`
if [ ! -d "$basedir" ]; then
echo "Directory $basedir extracted from the -f/--file command-line argument ${arg} does not exist" >&2
exit 1
fi
else
echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
exit 1
fi
break
fi
if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
found_file_switch=1
fi
done
echo "$basedir"
)
}

# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "`tr -s '\r\n' ' ' < "$1"`"
fi
}

MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`"
MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
Loading