Skip to content
Commits on Source (5)
......@@ -23,7 +23,7 @@ def buildOs = 'linux'
def buildJdk = '8'
def buildMvn = '3.6.0'
def runITsOses = ['linux', 'windows']
def runITsJdks = ['7', '8', '11']
def runITsJdks = ['7', '8', '11','12']
def runITsMvn = '3.6.0'
def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
def tests
......@@ -38,6 +38,13 @@ node(jenkinsEnv.nodeSelection(osNode)) {
}
def WORK_DIR=pwd()
def MAVEN_GOAL='verify'
stage('Configure deploy') {
if (env.BRANCH_NAME == 'master'){
MAVEN_GOAL='deploy'
}
}
stage('Build / Unit Test') {
String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
......@@ -51,7 +58,7 @@ node(jenkinsEnv.nodeSelection(osNode)) {
invokerPublisher(),
pipelineGraphPublisher()
]) {
sh "mvn clean verify -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
}
dir ('apache-maven/target') {
sh "mv apache-maven-*-bin.zip apache-maven-dist.zip"
......@@ -76,6 +83,7 @@ for (String os in runITsOses) {
runITsTasks[stageId] = {
node(jenkinsEnv.nodeSelection(osLabel)) {
stage("${stageLabel}") {
echo "NODE_NAME = ${env.NODE_NAME}"
// on Windows, need a short path or we hit 256 character limit for paths
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
// will not trample each other plus workaround for JENKINS-52657
......@@ -89,6 +97,7 @@ for (String os in runITsOses) {
bat "if exist apache-maven-dist.zip del /q apache-maven-dist.zip"
}
unstash 'dist'
try {
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
junitPublisher(ignoreAttachments: false)
]) {
......@@ -99,11 +108,16 @@ for (String os in runITsOses) {
}
if (isUnix()) {
sh 'df -hT'
sh "${cmd}"
} else {
bat 'wmic logicaldisk get size,freespace,caption'
bat "${cmd}"
}
}
} finally {
archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
deleteDir() // clean up after ourselves to reduce disk space
}
}
......@@ -111,6 +125,7 @@ for (String os in runITsOses) {
}
}
}
}
// run the parallel ITs
parallel(runITsTasks)
......@@ -148,3 +163,11 @@ parallel(runITsTasks)
jenkinsNotify()
}
}
def archiveDirs(stageId, archives) {
archives.each { archivePrefix, pathToContent ->
if (fileExists(pathToContent)) {
zip(zipFile: "${archivePrefix}-${stageId}.zip", dir: pathToContent, archive: true)
}
}
}
......@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
</parent>
<artifactId>apache-maven</artifactId>
......
maven (3.6.2-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
-- Emmanuel Bourg <ebourg@apache.org> Sun, 08 Sep 2019 17:46:29 +0200
maven (3.6.1-1) unstable; urgency=medium
* Team upload.
......
......@@ -2,5 +2,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin * * * *
org.codehaus.mojo buildnumber-maven-plugin * * * *
org.apache.maven.plugins maven-assembly-plugin * * * *
org.apache.maven.plugins maven-enforcer-plugin * * * *
org.apache.maven.plugins maven-failsafe-plugin * * * *
org.apache.rat apache-rat-plugin * * * *
org.powermock powermock-reflect * * * *
org.xmlunit * * * * *
......@@ -84,7 +84,7 @@ Bug: https://github.com/apache/maven/pull/118
</executions>
--- a/pom.xml
+++ b/pom.xml
@@ -594,6 +594,7 @@
@@ -607,6 +607,7 @@
<exclude>bootstrap/**</exclude>
<exclude>README.bootstrap.txt</exclude>
<exclude>README.md</exclude>
......
......@@ -19,5 +19,5 @@
# under the License.
#
mvn -Preporting site site:stage $@
mvn scm-publish:publish-scm $@
mvn -Preporting site site:stage "$@"
mvn scm-publish:publish-scm "$@"
......@@ -33,6 +33,17 @@ under the License.
<release>
<Version>
<name>Latest stable release</name>
<created>2019-04-04</created>
<revision>3.6.0</revision>
<file-release>http://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.zip</file-release>
<file-release>http://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz</file-release>
<file-release>http://archive.apache.org/dist/maven/maven-3/3.6.1/source/apache-maven-3.6.1-src.zip</file-release>
<file-release>http://archive.apache.org/dist/maven/maven-3/3.6.1/source/apache-maven-3.6.1-src.tar.gz</file-release>
</Version>
</release>
<release>
<Version>
<name>Apache Maven 3.6.0</name>
<created>2018-10-23</created>
<revision>3.6.0</revision>
<file-release>http://archive.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip</file-release>
......
......@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
</parent>
<artifactId>maven-artifact</artifactId>
......@@ -45,10 +45,6 @@ under the License.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
......@@ -60,6 +56,18 @@ under the License.
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
......@@ -54,18 +54,23 @@ else if ( Artifact.VERSION_FILE_PATTERN.matcher( version ).matches() )
public static String toSnapshotVersion( String version )
{
Validate.notBlank( version, "version can neither be null, empty nor blank" );
notBlank( version, "version can neither be null, empty nor blank" );
int lastHyphen = version.lastIndexOf( '-' );
if ( lastHyphen > 0 )
{
int prevHyphen = version.lastIndexOf( '-', lastHyphen - 1 );
if ( prevHyphen > 0 )
{
Matcher m = Artifact.VERSION_FILE_PATTERN.matcher( version );
if ( m.matches() )
{
return m.group( 1 ) + "-" + Artifact.SNAPSHOT_VERSION;
}
else
{
return version;
}
}
return version;
}
public static String versionlessKey( Artifact artifact )
{
......@@ -74,8 +79,8 @@ public static String versionlessKey( Artifact artifact )
public static String versionlessKey( String groupId, String artifactId )
{
Validate.notBlank( groupId, "groupId can neither be null, empty nor blank" );
Validate.notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
notBlank( groupId, "groupId can neither be null, empty nor blank" );
notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
return groupId + ":" + artifactId;
}
......@@ -87,13 +92,22 @@ public static String key( Artifact artifact )
public static String key( String groupId, String artifactId, String version )
{
Validate.notBlank( groupId, "groupId can neither be null, empty nor blank" );
Validate.notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
Validate.notBlank( version, "version can neither be null, empty nor blank" );
notBlank( groupId, "groupId can neither be null, empty nor blank" );
notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
notBlank( version, "version can neither be null, empty nor blank" );
return groupId + ":" + artifactId + ":" + version;
}
private static void notBlank( String str, String message )
{
int c = str != null && str.length() > 0 ? str.charAt( 0 ) : 0;
if ( ( c < '0' || c > '9' ) && ( c < 'a' || c > 'z' ) )
{
Validate.notBlank( str, message );
}
}
public static Map<String, Artifact> artifactMapByVersionlessId( Collection<Artifact> artifacts )
{
Map<String, Artifact> artifactMap = new LinkedHashMap<>();
......
......@@ -25,7 +25,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
......@@ -387,16 +386,7 @@ public void setBaseVersion( String baseVersion )
protected void setBaseVersionInternal( String baseVersion )
{
Matcher m = VERSION_FILE_PATTERN.matcher( baseVersion );
if ( m.matches() )
{
this.baseVersion = m.group( 1 ) + "-" + SNAPSHOT_VERSION;
}
else
{
this.baseVersion = baseVersion;
}
this.baseVersion = ArtifactUtils.toSnapshotVersion( baseVersion );
}
public int compareTo( Artifact a )
......
......@@ -29,8 +29,6 @@
import java.util.Locale;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
/**
* <p>
* Generic implementation of version comparison.
......@@ -150,6 +148,30 @@ public int compareTo( Item item )
}
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
IntItem intItem = (IntItem) o;
return value == intItem.value;
}
@Override
public int hashCode()
{
return value;
}
@Override
public String toString()
{
......@@ -211,6 +233,30 @@ public int compareTo( Item item )
}
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
LongItem longItem = (LongItem) o;
return value == longItem.value;
}
@Override
public int hashCode()
{
return (int) ( value ^ ( value >>> 32 ) );
}
@Override
public String toString()
{
......@@ -272,6 +318,29 @@ public int compareTo( Item item )
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
BigIntegerItem that = (BigIntegerItem) o;
return value.equals( that.value );
}
@Override
public int hashCode()
{
return value.hashCode();
}
public String toString()
{
return value.toString();
......@@ -292,6 +361,7 @@ private static class StringItem
{
ALIASES.put( "ga", "" );
ALIASES.put( "final", "" );
ALIASES.put( "release", "" );
ALIASES.put( "cr", "rc" );
}
......@@ -384,6 +454,29 @@ public int compareTo( Item item )
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
StringItem that = (StringItem) o;
return value.equals( that.value );
}
@Override
public int hashCode()
{
return value.hashCode();
}
public String toString()
{
return value;
......@@ -583,8 +676,6 @@ else if ( Character.isDigit( c ) )
list = (ListItem) stack.pop();
list.normalize();
}
canonical = items.toString();
}
private static Item parseItem( boolean isDigit, String buf )
......@@ -609,12 +700,19 @@ else if ( buf.length() <= MAX_LONGITEM_LENGTH )
private static String stripLeadingZeroes( String buf )
{
String strippedBuf = StringUtils.stripStart( buf, "0" );
if ( strippedBuf.isEmpty() )
if ( buf == null || buf.isEmpty() )
{
return "0";
}
return strippedBuf;
for ( int i = 0; i < buf.length(); ++i )
{
char c = buf.charAt( i );
if ( c != '0' )
{
return buf.substring( i );
}
}
return buf;
}
@Override
......@@ -631,19 +729,23 @@ public String toString()
public String getCanonical()
{
if ( canonical == null )
{
canonical = items.toString();
}
return canonical;
}
@Override
public boolean equals( Object o )
{
return ( o instanceof ComparableVersion ) && canonical.equals( ( (ComparableVersion) o ).canonical );
return ( o instanceof ComparableVersion ) && items.equals( ( (ComparableVersion) o ).items );
}
@Override
public int hashCode()
{
return canonical.hashCode();
return items.hashCode();
}
// CHECKSTYLE_OFF: LineLength
......
......@@ -20,8 +20,8 @@
*/
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.NoSuchElementException;
import static org.apache.commons.lang3.math.NumberUtils.isDigits;
/**
* Default implementation of artifact versioning.
......@@ -128,18 +128,15 @@ public final void parseVersion( String version )
if ( part2 != null )
{
try
{
if ( ( part2.length() == 1 ) || !part2.startsWith( "0" ) )
if ( part2.length() == 1 || !part2.startsWith( "0" ) )
{
buildNumber = Integer.valueOf( part2 );
}
else
buildNumber = tryParseInt( part2 );
if ( buildNumber == null )
{
qualifier = part2;
}
}
catch ( NumberFormatException e )
else
{
qualifier = part2;
}
......@@ -147,11 +144,8 @@ public final void parseVersion( String version )
if ( ( !part1.contains( "." ) ) && !part1.startsWith( "0" ) )
{
try
{
majorVersion = Integer.valueOf( part1 );
}
catch ( NumberFormatException e )
majorVersion = tryParseInt( part1 );
if ( majorVersion == null )
{
// qualifier is the whole version, including "-"
qualifier = version;
......@@ -163,21 +157,38 @@ public final void parseVersion( String version )
boolean fallback = false;
StringTokenizer tok = new StringTokenizer( part1, "." );
try
if ( tok.hasMoreTokens() )
{
majorVersion = getNextIntegerToken( tok );
if ( majorVersion == null )
{
fallback = true;
}
}
else
{
fallback = true;
}
if ( tok.hasMoreTokens() )
{
minorVersion = getNextIntegerToken( tok );
if ( minorVersion == null )
{
fallback = true;
}
}
if ( tok.hasMoreTokens() )
{
incrementalVersion = getNextIntegerToken( tok );
if ( incrementalVersion == null )
{
fallback = true;
}
}
if ( tok.hasMoreTokens() )
{
qualifier = tok.nextToken();
fallback = Pattern.compile( "\\d+" ).matcher( qualifier ).matches();
fallback = isDigits( qualifier );
}
// string tokenizer won't detect these and ignores them
......@@ -185,11 +196,6 @@ public final void parseVersion( String version )
{
fallback = true;
}
}
catch ( NumberFormatException e )
{
fallback = true;
}
if ( fallback )
{
......@@ -204,19 +210,36 @@ public final void parseVersion( String version )
}
private static Integer getNextIntegerToken( StringTokenizer tok )
{
try
{
String s = tok.nextToken();
if ( ( s.length() > 1 ) && s.startsWith( "0" ) )
{
throw new NumberFormatException( "Number part has a leading 0: '" + s + "'" );
return null;
}
return Integer.valueOf( s );
return tryParseInt( s );
}
catch ( NoSuchElementException e )
private static Integer tryParseInt( String s )
{
// for performance, check digits instead of relying later on catching NumberFormatException
if ( !isDigits( s ) )
{
return null;
}
try
{
long longValue = Long.parseLong( s );
if ( longValue > Integer.MAX_VALUE )
{
return null;
}
return (int) longValue;
}
catch ( NumberFormatException e )
{
throw new NumberFormatException( "Number is invalid" );
// should never happen since checked isDigits(s) before
return null;
}
}
......
package org.apache.maven.artifact.versioning;
/*
* 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.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.regex.Pattern;
import org.junit.Test;
public class ComparableVersionIT
{
@Test
public void test()
throws Exception
{
Files.walkFileTree( Paths.get( "target" ), new SimpleFileVisitor<Path>()
{
Pattern mavenArtifactJar = Pattern.compile( "maven-artifact-[\\d.]+(-SNAPSHOT)?\\.jar" );
@Override
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs )
throws IOException
{
String filename = file.getFileName().toString();
if ( mavenArtifactJar.matcher( filename ).matches() )
{
Process p = Runtime.getRuntime().exec( new String[] {
Paths.get( System.getProperty( "java.home" ), "bin/java" ).toString(),
"-jar",
file.toAbsolutePath().toString(),
"5.32",
"5.27" } );
try
{
assertEquals( "Unexpected exit code", 0, p.waitFor() );
}
catch ( InterruptedException e )
{
fail( e.getMessage() );
}
return FileVisitResult.TERMINATE;
}
else
{
return FileVisitResult.CONTINUE;
}
}
@Override
public FileVisitResult preVisitDirectory( Path dir, BasicFileAttributes attrs )
throws IOException
{
if ( Paths.get( "target" ).equals( dir ) )
{
return FileVisitResult.CONTINUE;
}
else
{
return FileVisitResult.SKIP_SUBTREE;
}
}
} );
}
}
......@@ -135,6 +135,7 @@ public void testVersionsEqual()
// aliases
checkVersionsEqual( "1ga", "1" );
checkVersionsEqual( "1release", "1" );
checkVersionsEqual( "1final", "1" );
checkVersionsEqual( "1cr", "1rc" );
......@@ -150,6 +151,9 @@ public void testVersionsEqual()
checkVersionsEqual( "1M", "1m" );
checkVersionsEqual( "1Ga", "1" );
checkVersionsEqual( "1GA", "1" );
checkVersionsEqual( "1RELEASE", "1" );
checkVersionsEqual( "1release", "1" );
checkVersionsEqual( "1RELeaSE", "1" );
checkVersionsEqual( "1Final", "1" );
checkVersionsEqual( "1FinaL", "1" );
checkVersionsEqual( "1FINAL", "1" );
......
......@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
</parent>
<artifactId>maven-builder-support</artifactId>
......
......@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
</parent>
<artifactId>maven-compat</artifactId>
......
......@@ -360,7 +360,7 @@ protected RepositorySystemSession initRepoSession()
DependencyGraphTransformer transformer =
new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
new SimpleOptionalitySelector(), new JavaScopeDeriver() );
new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
transformer = new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
session.setDependencyGraphTransformer( transformer );
LocalRepository localRepo = new LocalRepository( localRepository().getBasedir() );
......
......@@ -27,16 +27,20 @@
import org.apache.maven.model.Profile;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileManager;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusTestCase;
public class DefaultProfileManagerTest
extends PlexusTestCase
{
public void setUp()
throws Exception
@Override
protected void customizeContainerConfiguration( ContainerConfiguration configuration )
{
super.setUp();
super.customizeContainerConfiguration( configuration );
configuration.setAutoWiring( true );
configuration.setClassPathScanning( PlexusConstants.SCANNING_ON );
}
public void testShouldActivateDefaultProfile()
......
......@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
</parent>
<artifactId>maven-core</artifactId>
......
......@@ -39,11 +39,11 @@ public class DefaultArtifactHandlerManager
@Requirement( role = ArtifactHandler.class )
private Map<String, ArtifactHandler> artifactHandlers;
private Map<String, ArtifactHandler> unmanagedHandlers = new ConcurrentHashMap<>();
private Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
public ArtifactHandler getArtifactHandler( String type )
{
ArtifactHandler handler = unmanagedHandlers.get( type );
ArtifactHandler handler = allHandlers.get( type );
if ( handler == null )
{
......@@ -53,6 +53,10 @@ public ArtifactHandler getArtifactHandler( String type )
{
handler = new DefaultArtifactHandler( type );
}
else
{
allHandlers.put( type, handler );
}
}
return handler;
......@@ -61,7 +65,7 @@ public ArtifactHandler getArtifactHandler( String type )
public void addHandlers( Map<String, ArtifactHandler> handlers )
{
// legacy support for maven-gpg-plugin:1.0
unmanagedHandlers.putAll( handlers );
allHandlers.putAll( handlers );
}
@Deprecated
......