File tree Expand file tree Collapse file tree 10 files changed +112
-25
lines changed
maven-wrapper-distribution/src/resources
projects/snapshot_distribution_test
apache-maven-4.9.999-20250710.120440-1-bin.zip/apache-maven-4.9.999-SNAPSHOT/bin
src/test/resources/repository/org/apache/maven/apache-maven/4.1.0-SNAPSHOT Expand file tree Collapse file tree 10 files changed +112
-25
lines changed Original file line number Diff line number Diff line change 268268
269269# If not found, search for any directory with the Maven executable (for snapshots)
270270if [ -z " $actualDistributionDir " ]; then
271+ # enable globbing to iterate over items
272+ set +f
271273 for dir in " $TMP_DOWNLOAD_DIR " /* ; do
272274 if [ -d " $dir " ]; then
273275 if [ -f " $dir /bin/$MVN_CMD " ]; then
@@ -276,9 +278,12 @@ if [ -z "$actualDistributionDir" ]; then
276278 fi
277279 fi
278280 done
281+ set -f
279282fi
280283
281284if [ -z " $actualDistributionDir " ]; then
285+ verbose " Contents of $TMP_DOWNLOAD_DIR :"
286+ verbose " $( ls -la " $TMP_DOWNLOAD_DIR " ) "
282287 die " Could not find Maven distribution directory in extracted archive"
283288fi
284289
Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ under the License.
174174 </extraArtifacts >
175175 <scriptVariables >
176176 <wrapperCurrentVersion >${project.version} </wrapperCurrentVersion >
177+ <mrmRepositoryUrl >${mrm.repository.url} </mrmRepositoryUrl >
177178 </scriptVariables >
178179 </configuration >
179180 <executions >
@@ -188,33 +189,16 @@ under the License.
188189 </executions >
189190 </plugin >
190191
191- <plugin >
192- <groupId >org.apache.maven.plugins</groupId >
193- <artifactId >maven-antrun-plugin</artifactId >
194- <version >3.1.0</version >
195- <executions >
196- <execution >
197- <id >copy-snapshot-distribution</id >
198- <goals >
199- <goal >run</goal >
200- </goals >
201- <phase >pre-integration-test</phase >
202- <configuration >
203- <target >
204- <mkdir dir =" ${project.build.directory}/local-repo/org/apache/maven/apache-maven/4.1.0-SNAPSHOT" />
205- <copy file =" ${project.basedir}/../src/test/resources/repository/org/apache/maven/apache-maven/4.1.0-SNAPSHOT/apache-maven-4.1.0-20250710.120440-1-bin.zip" todir =" ${project.build.directory}/local-repo/org/apache/maven/apache-maven/4.1.0-SNAPSHOT" />
206- </target >
207- </configuration >
208- </execution >
209- </executions >
210- </plugin >
211-
212192 <plugin >
213193 <groupId >org.codehaus.mojo</groupId >
214194 <artifactId >mrm-maven-plugin</artifactId >
215195 <version >1.7.0</version >
216196 <configuration >
217197 <repositories >
198+ <mockRepo >
199+ <source >src/it/repository</source >
200+ <cloneTo >${project.build.directory} /mock-repo</cloneTo >
201+ </mockRepo >
218202 <localRepo >
219203 <source >${project.build.directory} /local-repo</source >
220204 </localRepo >
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ under the License.
4343 <configuration >
4444 <executable >mvnw${cmd} </executable >
4545 <successCodes >
46- <successCode >1 </successCode >
46+ <successCode >0 </successCode >
4747 </successCodes >
4848 <arguments >
4949 <argument >-v</argument >
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+
20+ def userProperties = context. get(' userProperties' )
21+
22+ userProperties. put(' distributionUrl' , mrmRepositoryUrl + ' /org/apache/maven/apache-maven/4.9.999-SNAPSHOT/apache-maven-4.9.999-20250710.120440-1-bin.zip' )
Original file line number Diff line number Diff line change 1717
1818# Test properties for snapshot distribution integration test
1919type =only-script
20- distributionUrl =@mrm.repository.url@/org/apache/maven/apache-maven/4.1.0-SNAPSHOT/apache-maven-4.1.0-20250710.120440-1-bin.zip
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ assert props.distributionType.equals("only-script")
3535
3636// The plugin should have used our custom timestamped snapshot URL
3737println " Generated distribution URL: ${ props.distributionUrl} "
38- assert props. distributionUrl. contains(" apache-maven-4.1.0 -20250710.120440-1-bin.zip" ), " Expected timestamped snapshot distribution URL but got: ${ props.distributionUrl} "
39- assert props. distributionUrl. contains(" /org/apache/maven/apache-maven/4.1.0 -SNAPSHOT/" ), " Expected Maven repository path but got: ${ props.distributionUrl} "
38+ assert props. distributionUrl. contains(" apache-maven-4.9.999 -20250710.120440-1-bin.zip" ), " Expected timestamped snapshot distribution URL but got: ${ props.distributionUrl} "
39+ assert props. distributionUrl. contains(" /org/apache/maven/apache-maven/4.9.999 -SNAPSHOT/" ), " Expected Maven repository path but got: ${ props.distributionUrl} "
4040
4141println " ✓ Plugin correctly used custom distributionUrl parameter"
4242println " ✓ Distribution URL: ${ props.distributionUrl} "
@@ -54,3 +54,7 @@ println "✓ Plugin correctly accepted custom distributionUrl parameter"
5454println " ✓ Wrapper configured to use timestamped snapshot URL: ${ props.distributionUrl} "
5555println " ✓ This tests the scenario where ZIP filename != directory name inside ZIP"
5656println " ✓ Our fix should handle: apache-maven-4.1.0-20250710.120440-1-bin.zip -> apache-maven-4.1.0-SNAPSHOT/"
57+
58+ log = new File (basedir, ' build.log' ). text
59+ // check "mvnw" output
60+ assert log. contains(' Apache Maven 4.9.999 from SNAPSHOT distribution' ), " Expected 'Apache Maven 4.9.999 from SNAPSHOT distribution' in build.log but not found"
Original file line number Diff line number Diff line change 1+ #\!/bin/bash
2+ # ----------------------------------------------------------------------------
3+ # Licensed to the Apache Software Foundation (ASF) under one
4+ # or more contributor license agreements. See the NOTICE file
5+ # distributed with this work for additional information
6+ # regarding copyright ownership. The ASF licenses this file
7+ # to you under the Apache License, Version 2.0 (the
8+ # "License"); you may not use this file except in compliance
9+ # with the License. You may obtain a copy of the License at
10+ #
11+ # http://www.apache.org/licenses/LICENSE-2.0
12+ #
13+ # Unless required by applicable law or agreed to in writing,
14+ # software distributed under the License is distributed on an
15+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+ # KIND, either express or implied. See the License for the
17+ # specific language governing permissions and limitations
18+ # under the License.
19+ # ----------------------------------------------------------------------------
20+
21+ # Minimal fake Maven script for testing
22+ echo "Apache Maven 4.9.999 from SNAPSHOT distribution"
23+ echo "Maven home: $(dirname "$(dirname "$(readlink -f "$0")")")"
24+ exit 0
Original file line number Diff line number Diff line change 1+ @ echo off
2+ @ REM ----------------------------------------------------------------------------
3+ @ REM Licensed to the Apache Software Foundation (ASF) under one
4+ @ REM or more contributor license agreements. See the NOTICE file
5+ @ REM distributed with this work for additional information
6+ @ REM regarding copyright ownership. The ASF licenses this file
7+ @ REM to you under the Apache License, Version 2.0 (the
8+ @ REM "License"); you may not use this file except in compliance
9+ @ REM with the License. You may obtain a copy of the License at
10+ @ REM
11+ @ REM http://www.apache.org/licenses/LICENSE-2.0
12+ @ REM
13+ @ REM Unless required by applicable law or agreed to in writing,
14+ @ REM software distributed under the License is distributed on an
15+ @ REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+ @ REM KIND, either express or implied. See the License for the
17+ @ REM specific language governing permissions and limitations
18+ @ REM under the License.
19+ @ REM ----------------------------------------------------------------------------
20+
21+ rem Minimal fake Maven script for testing
22+ echo Apache Maven 4.9.999 from SNAPSHOT distribution
23+ echo Maven home: %~dp0 ..
24+ exit /b 0
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <!--
3+ Licensed to the Apache Software Foundation (ASF) under one
4+ or more contributor license agreements. See the NOTICE file
5+ distributed with this work for additional information
6+ regarding copyright ownership. The ASF licenses this file
7+ to you under the Apache License, Version 2.0 (the
8+ "License"); you may not use this file except in compliance
9+ with the License. You may obtain a copy of the License at
10+
11+ http://www.apache.org/licenses/LICENSE-2.0
12+
13+ Unless required by applicable law or agreed to in writing,
14+ software distributed under the License is distributed on an
15+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+ KIND, either express or implied. See the License for the
17+ specific language governing permissions and limitations
18+ under the License.
19+ -->
20+ <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 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
21+ <modelVersion >4.0.0</modelVersion >
22+ <groupId >org.apache.maven</groupId >
23+ <artifactId >apache-maven</artifactId >
24+ <version >4.9.999-SNAPSHOT</version >
25+ </project >
You can’t perform that action at this time.
0 commit comments