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

Commit 4498b1b

Browse files
committed
[MWRAPPER-14] first step at putting all wrapper pieces in one build
- wrapper (maven-wrapper.jar) - wrapper distribution (mvnw scripts) - wrapper plugin
1 parent 06cc93c commit 4498b1b

File tree

78 files changed

+3169
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3169
-63
lines changed

maven-wrapper-distribution/pom.xml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<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">
23+
<modelVersion>4.0.0</modelVersion>
24+
<parent>
25+
<groupId>org.apache.maven</groupId>
26+
<artifactId>maven-wrapper-parent</artifactId>
27+
<version>3.0.3-SNAPSHOT</version>
28+
</parent>
29+
30+
<artifactId>maven-wrapper-distribution</artifactId>
31+
<packaging>pom</packaging>
32+
33+
<name>Maven Wrapper Distribution</name>
34+
<description>The Maven Wrapper distribution zips in 3 types: script, bin and source.</description>
35+
36+
<build>
37+
<pluginManagement>
38+
<plugins>
39+
<plugin>
40+
<groupId>org.apache.rat</groupId>
41+
<artifactId>apache-rat-plugin</artifactId>
42+
<configuration>
43+
<excludes combine.children="append">
44+
<exclude>src/assembly/maven/bin/m2.conf</exclude>
45+
<!-- these are partial scripts, resulting in mwnw scripts -->
46+
<exclude>src/assembly/maven/init</exclude>
47+
<exclude>src/assembly/maven/init.cmd</exclude>
48+
<exclude>src/assembly/maven/run</exclude>
49+
<exclude>src/assembly/maven/run.cmd</exclude>
50+
<exclude>src/assembly/shared/mvnwlauncher</exclude>
51+
<exclude>src/assembly/shared/mvnwlauncher.cmd</exclude>
52+
<exclude>src/assembly/*/download</exclude>
53+
<exclude>src/assembly/*/download.cmd</exclude>
54+
</excludes>
55+
</configuration>
56+
</plugin>
57+
<plugin>
58+
<groupId>org.apache.maven.plugins</groupId>
59+
<artifactId>maven-clean-plugin</artifactId>
60+
<configuration>
61+
<skip>true</skip> <!-- sharing outputDirectory with maven-dist -->
62+
</configuration>
63+
</plugin>
64+
</plugins>
65+
</pluginManagement>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-assembly-plugin</artifactId>
70+
<executions>
71+
<execution>
72+
<phase>package</phase>
73+
<goals>
74+
<goal>single</goal>
75+
</goals>
76+
</execution>
77+
</executions>
78+
<configuration>
79+
<descriptors>
80+
<descriptor>src/assembly/script.xml</descriptor>
81+
<descriptor>src/assembly/bin.xml</descriptor>
82+
<descriptor>src/assembly/source.xml</descriptor>
83+
</descriptors>
84+
</configuration>
85+
</plugin>
86+
</plugins>
87+
</build>
88+
89+
<dependencies>
90+
<dependency>
91+
<groupId>org.apache.maven</groupId>
92+
<artifactId>maven-wrapper</artifactId>
93+
<version>${project.version}</version>
94+
</dependency>
95+
</dependencies>
96+
97+
<profiles>
98+
<profile>
99+
<id>apache-release</id>
100+
<build>
101+
<plugins>
102+
<!-- calculate sha512 checksums -->
103+
<plugin>
104+
<groupId>net.nicoulaj.maven.plugins</groupId>
105+
<artifactId>checksum-maven-plugin</artifactId>
106+
<executions>
107+
<execution>
108+
<id>source-release-checksum</id>
109+
<goals>
110+
<goal>files</goal>
111+
</goals>
112+
</execution>
113+
</executions>
114+
<configuration>
115+
<fileSets>
116+
<fileSet>
117+
<directory>${project.build.directory}</directory>
118+
<includes>
119+
<include>${project.artifactId}-${project.version}-bin.zip</include>
120+
<include>${project.artifactId}-${project.version}-script.zip</include>
121+
<include>${project.artifactId}-${project.version}-source.zip</include>
122+
</includes>
123+
</fileSet>
124+
</fileSets>
125+
<failIfNoFiles>true</failIfNoFiles>
126+
</configuration>
127+
</plugin>
128+
</plugins>
129+
</build>
130+
</profile>
131+
</profiles>
132+
</project>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
25+
<id>bin</id>
26+
<formats>
27+
<format>zip</format>
28+
</formats>
29+
<includeBaseDirectory>false</includeBaseDirectory>
30+
<dependencySets>
31+
<dependencySet>
32+
<useProjectArtifact>false</useProjectArtifact>
33+
<includes>
34+
<include>org.apache.maven:maven-wrapper:jar:*</include>
35+
</includes>
36+
<outputDirectory>.mvn/wrapper</outputDirectory>
37+
<outputFileNameMapping>maven-wrapper.jar</outputFileNameMapping>
38+
</dependencySet>
39+
</dependencySets>
40+
<files>
41+
<file>
42+
<source>src/assembly/shared/mvnwDebug.cmd</source>
43+
<outputDirectory>.</outputDirectory>
44+
<lineEnding>dos</lineEnding>
45+
</file>
46+
<file>
47+
<source>src/assembly/shared/mvnwDebug</source>
48+
<outputDirectory>.</outputDirectory>
49+
<lineEnding>unix</lineEnding>
50+
<fileMode>0755</fileMode>
51+
</file>
52+
<file>
53+
<sources>
54+
<source>src/assembly/maven/validate.cmd</source>
55+
<source>src/assembly/maven/init.cmd</source>
56+
<source>src/assembly/shared/mvnwlauncher.cmd</source>
57+
<source>src/assembly/maven/run.cmd</source>
58+
</sources>
59+
<destName>mvnw.cmd</destName>
60+
<outputDirectory>.</outputDirectory>
61+
<lineEnding>dos</lineEnding>
62+
<filtered>true</filtered>
63+
</file>
64+
<file>
65+
<sources>
66+
<source>src/assembly/maven/validate</source>
67+
<source>src/assembly/maven/init</source>
68+
<source>src/assembly/shared/mvnwlauncher</source>
69+
<source>src/assembly/maven/run</source>
70+
</sources>
71+
<destName>mvnw</destName>
72+
<outputDirectory>.</outputDirectory>
73+
<lineEnding>unix</lineEnding>
74+
<fileMode>0755</fileMode>
75+
<filtered>true</filtered>
76+
</file>
77+
</files>
78+
<fileSets>
79+
<fileSet>
80+
<directory>src/assembly/shared/mvn</directory>
81+
<outputDirectory>.mvn</outputDirectory>
82+
<filtered>true</filtered>
83+
</fileSet>
84+
</fileSets>
85+
</assembly>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
CLASSWORLDS_CONF="$MAVEN_HOME/bin/m2.conf"
2+
3+
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
4+
if $cygwin || $mingw ; then
5+
[ -n "$JAVA_HOME" ] &&
6+
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
7+
fi
8+
9+
if [ -n "$JAVA_HOME" ] ; then
10+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
11+
# IBM's JDK on AIX uses strange locations for the executables
12+
JAVACMD="$JAVA_HOME/jre/sh/java"
13+
else
14+
JAVACMD="$JAVA_HOME/bin/java"
15+
16+
if [ ! -x "$JAVACMD" ] ; then
17+
echo "The JAVA_HOME environment variable is not defined correctly, so Apache Maven cannot be started." >&2
18+
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" does not exist." >&2
19+
exit 1
20+
fi
21+
fi
22+
else
23+
JAVACMD="`\\unset -f command; \\command -v java`"
24+
25+
if [ ! -x "$JAVACMD" ] ; then
26+
echo "The java(1) command does not exist in PATH nor is JAVA_HOME set, so Apache Maven cannot be started." >&2
27+
exit 1
28+
fi
29+
fi
30+
31+
# traverses directory structure from process work directory to filesystem root
32+
# first directory with .mvn subdirectory is considered project base directory
33+
find_maven_basedir() {
34+
(
35+
basedir=`find_file_argument_basedir "$@"`
36+
wdir="$basedir"
37+
while [ "$wdir" != '/' ] ; do
38+
if [ -d "$wdir"/.mvn ] ; then
39+
basedir=$wdir
40+
break
41+
fi
42+
wdir=`cd "$wdir/.."; pwd`
43+
done
44+
echo "$basedir"
45+
)
46+
}
47+
48+
find_file_argument_basedir() {
49+
(
50+
basedir=`pwd`
51+
52+
found_file_switch=0
53+
for arg in "$@"; do
54+
if [ ${found_file_switch} -eq 1 ]; then
55+
if [ -d "${arg}" ]; then
56+
basedir=`cd "${arg}" && pwd -P`
57+
elif [ -f "${arg}" ]; then
58+
basedir=`dirname "${arg}"`
59+
basedir=`cd "$basedir" && pwd -P`
60+
if [ ! -d "$basedir" ]; then
61+
echo "Directory $basedir extracted from the -f/--file command-line argument ${arg} does not exist" >&2
62+
exit 1
63+
fi
64+
else
65+
echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
66+
exit 1
67+
fi
68+
break
69+
fi
70+
if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
71+
found_file_switch=1
72+
fi
73+
done
74+
echo "$basedir"
75+
)
76+
}
77+
78+
# concatenates all lines of a file
79+
concat_lines() {
80+
if [ -f "$1" ]; then
81+
echo "`tr -s '\r\n' ' ' < "$1"`"
82+
fi
83+
}
84+
85+
MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`"
86+
MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"

0 commit comments

Comments
 (0)