mirror of https://github.com/apache/maven.git
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/maven into trunk
This commit is contained in:
commit
8181e7c7fa
|
@ -1,2 +1,8 @@
|
||||||
*.jar -text -crlf
|
# Auto detect text files and perform LF normalization
|
||||||
*.graffle -text -crlf
|
* text=auto
|
||||||
|
|
||||||
|
*.java text diff=java
|
||||||
|
*.html text diff=html
|
||||||
|
*.css text
|
||||||
|
*.js text
|
||||||
|
*.sql text
|
||||||
|
|
|
@ -10,3 +10,5 @@ bin/
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/bootstrap
|
||||||
|
/dependencies.xml
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
Apache Maven
|
Apache Maven
|
||||||
Copyright 2001-2011 The Apache Software Foundation
|
Copyright 2001-2012 The Apache Software Foundation
|
||||||
|
|
||||||
This product includes software developed by
|
This product includes software developed by
|
||||||
The Apache Software Foundation (http://www.apache.org/).
|
The Apache Software Foundation (http://www.apache.org/).
|
||||||
|
|
|
@ -40,18 +40,18 @@
|
||||||
1) Unpack the archive where you would like to store the binaries, eg:
|
1) Unpack the archive where you would like to store the binaries, eg:
|
||||||
|
|
||||||
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
|
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
|
||||||
tar zxvf apache-maven-3.0.x.tar.gz
|
tar zxvf apache-maven-3.x.y.tar.gz
|
||||||
Windows 2000/XP
|
Windows 2000/XP
|
||||||
unzip apache-maven-3.0.x.zip
|
unzip apache-maven-3.x.y.zip
|
||||||
|
|
||||||
2) A directory called "apache-maven-3.0.x" will be created.
|
2) A directory called "apache-maven-3.x.y" will be created.
|
||||||
|
|
||||||
3) Add the bin directory to your PATH, eg:
|
3) Add the bin directory to your PATH, eg:
|
||||||
|
|
||||||
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
|
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
|
||||||
export PATH=/usr/local/apache-maven-3.0.x/bin:$PATH
|
export PATH=/usr/local/apache-maven-3.x.y/bin:$PATH
|
||||||
Windows 2000/XP
|
Windows 2000/XP
|
||||||
set PATH="c:\program files\apache-maven-3.0.x\bin";%PATH%
|
set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH%
|
||||||
|
|
||||||
4) Make sure JAVA_HOME is set to the location of your JDK
|
4) Make sure JAVA_HOME is set to the location of your JDK
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
Downloads: http://maven.apache.org/download.html
|
Downloads: http://maven.apache.org/download.html
|
||||||
Release Notes: http://maven.apache.org/release-notes.html
|
Release Notes: http://maven.apache.org/release-notes.html
|
||||||
Mailing Lists: http://maven.apache.org/mail-lists.html
|
Mailing Lists: http://maven.apache.org/mail-lists.html
|
||||||
Source Code: http://svn.apache.org/repos/asf/maven/
|
Source Code: https://git-wip-us.apache.org/repos/asf/maven.git/apache-maven
|
||||||
Issue Tracking: http://jira.codehaus.org/browse/MNG
|
Issue Tracking: http://jira.codehaus.org/browse/MNG
|
||||||
Wiki: http://docs.codehaus.org/display/MAVENUSER/
|
Wiki: https://cwiki.apache.org/confluence/display/MAVEN/
|
||||||
Available Plugins: http://maven.apache.org/plugins/index.html
|
Available Plugins: http://maven.apache.org/plugins/index.html
|
||||||
|
|
|
@ -36,6 +36,9 @@ END SNIPPET: ant-bootstrap -->
|
||||||
<property name="distributionShortName" value="Maven"/>
|
<property name="distributionShortName" value="Maven"/>
|
||||||
<property name="distributionName" value="Apache Maven"/>
|
<property name="distributionName" value="Apache Maven"/>
|
||||||
<property name="it.workdir.version" value="3.0.x" />
|
<property name="it.workdir.version" value="3.0.x" />
|
||||||
|
<property name="maven-compile.jvmargs" value="-Xmx512m -Xms512m"/>
|
||||||
|
<property name="maven-compile.fork" value="true"/>
|
||||||
|
<property name="maven-compile.maxmemory" value="512m"/>
|
||||||
|
|
||||||
<target name="initTaskDefs">
|
<target name="initTaskDefs">
|
||||||
<echo>Building ${distributionName} ...</echo>
|
<echo>Building ${distributionName} ...</echo>
|
||||||
|
@ -247,8 +250,9 @@ Do you want to continue?</input>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
||||||
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
|
<java fork="${maven-compile.fork}" classname="org.apache.maven.cli.MavenCli" failonerror="true" timeout="600000" maxmemory="${maven-compile.maxmemory}">
|
||||||
<!--jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
|
<!--jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
|
||||||
|
<!--jvmarg value="${maven-compile.jvmargs}"/-->
|
||||||
<classpath refid="maven.classpath" />
|
<classpath refid="maven.classpath" />
|
||||||
<arg value="${maven.debug}" />
|
<arg value="${maven.debug}" />
|
||||||
<arg value="-B" />
|
<arg value="-B" />
|
||||||
|
|
|
@ -88,7 +88,6 @@ public class DefaultArtifactDescriptorReader
|
||||||
implements ArtifactDescriptorReader, Service
|
implements ArtifactDescriptorReader, Service
|
||||||
{
|
{
|
||||||
|
|
||||||
@SuppressWarnings( "unused" )
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger = NullLogger.INSTANCE;
|
private Logger logger = NullLogger.INSTANCE;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.repository.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -27,10 +26,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
|
||||||
import org.sonatype.aether.RepositoryEvent.EventType;
|
import org.sonatype.aether.RepositoryEvent.EventType;
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
import org.sonatype.aether.RequestTrace;
|
import org.sonatype.aether.RequestTrace;
|
||||||
|
@ -69,9 +66,6 @@ public class DefaultVersionRangeResolver
|
||||||
implements VersionRangeResolver, Service
|
implements VersionRangeResolver, Service
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
|
||||||
|
|
||||||
@SuppressWarnings( "unused" )
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger = NullLogger.INSTANCE;
|
private Logger logger = NullLogger.INSTANCE;
|
||||||
|
|
||||||
|
@ -190,7 +184,7 @@ public class DefaultVersionRangeResolver
|
||||||
|
|
||||||
Metadata metadata =
|
Metadata metadata =
|
||||||
new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
|
new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
|
||||||
MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT );
|
MavenMetadata.MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT );
|
||||||
|
|
||||||
List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>( request.getRepositories().size() );
|
List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>( request.getRepositories().size() );
|
||||||
|
|
||||||
|
@ -244,39 +238,25 @@ public class DefaultVersionRangeResolver
|
||||||
{
|
{
|
||||||
Versioning versioning = null;
|
Versioning versioning = null;
|
||||||
|
|
||||||
FileInputStream fis = null;
|
if ( metadata != null )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if ( metadata != null )
|
SyncContext syncContext = syncContextFactory.newInstance( session, true );
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SyncContext syncContext = syncContextFactory.newInstance( session, true );
|
syncContext.acquire( null, Collections.singleton( metadata ) );
|
||||||
|
|
||||||
try
|
versioning = MavenMetadata.read( metadata.getFile() ).getVersioning();
|
||||||
{
|
}
|
||||||
syncContext.acquire( null, Collections.singleton( metadata ) );
|
catch ( Exception e )
|
||||||
|
{
|
||||||
if ( metadata.getFile() != null && metadata.getFile().exists() )
|
invalidMetadata( session, trace, metadata, repository, e );
|
||||||
{
|
result.addException( e );
|
||||||
fis = new FileInputStream( metadata.getFile() );
|
}
|
||||||
org.apache.maven.artifact.repository.metadata.Metadata m =
|
finally
|
||||||
new MetadataXpp3Reader().read( fis, false );
|
{
|
||||||
versioning = m.getVersioning();
|
syncContext.release();
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
syncContext.release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch ( Exception e )
|
|
||||||
{
|
|
||||||
invalidMetadata( session, trace, metadata, repository, e );
|
|
||||||
result.addException( e );
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close( fis );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( versioning != null ) ? versioning : new Versioning();
|
return ( versioning != null ) ? versioning : new Versioning();
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.maven.repository.internal;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -31,10 +30,8 @@ import java.util.Map;
|
||||||
import org.apache.maven.artifact.repository.metadata.Snapshot;
|
import org.apache.maven.artifact.repository.metadata.Snapshot;
|
||||||
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
|
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.sonatype.aether.RepositoryCache;
|
import org.sonatype.aether.RepositoryCache;
|
||||||
import org.sonatype.aether.RepositoryEvent.EventType;
|
import org.sonatype.aether.RepositoryEvent.EventType;
|
||||||
|
@ -68,22 +65,25 @@ import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
|
||||||
import org.sonatype.aether.util.metadata.DefaultMetadata;
|
import org.sonatype.aether.util.metadata.DefaultMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Maven meta-version resolver: supports <code>*-SNAPSHOT</code>, <code>RELEASE</code> and <code>LATEST</code>
|
||||||
|
* meta-version resolution from
|
||||||
|
* <a href="../maven-repository-metadata/repository-metadata.html#class_versioning"><code>versioning</code>
|
||||||
|
* element in repositories' <code>maven-metadata.xml</code></a>.
|
||||||
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
* @see Versioning
|
||||||
*/
|
*/
|
||||||
@Component( role = VersionResolver.class )
|
@Component( role = VersionResolver.class )
|
||||||
public class DefaultVersionResolver
|
public class DefaultVersionResolver
|
||||||
implements VersionResolver, Service
|
implements VersionResolver, Service
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
|
||||||
|
|
||||||
private static final String RELEASE = "RELEASE";
|
private static final String RELEASE = "RELEASE";
|
||||||
|
|
||||||
private static final String LATEST = "LATEST";
|
private static final String LATEST = "LATEST";
|
||||||
|
|
||||||
private static final String SNAPSHOT = "SNAPSHOT";
|
private static final String SNAPSHOT = "SNAPSHOT";
|
||||||
|
|
||||||
@SuppressWarnings( "unused" )
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger = NullLogger.INSTANCE;
|
private Logger logger = NullLogger.INSTANCE;
|
||||||
|
|
||||||
|
@ -143,8 +143,6 @@ public class DefaultVersionResolver
|
||||||
public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
|
public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
|
||||||
throws VersionResolutionException
|
throws VersionResolutionException
|
||||||
{
|
{
|
||||||
RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request );
|
|
||||||
|
|
||||||
Artifact artifact = request.getArtifact();
|
Artifact artifact = request.getArtifact();
|
||||||
|
|
||||||
String version = artifact.getVersion();
|
String version = artifact.getVersion();
|
||||||
|
@ -169,127 +167,81 @@ public class DefaultVersionResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata metadata;
|
|
||||||
|
|
||||||
if ( RELEASE.equals( version ) )
|
if ( RELEASE.equals( version ) )
|
||||||
{
|
{
|
||||||
metadata =
|
Map<String, VersionInfo> infos = readVersionInfoMap( session, result, Metadata.Nature.RELEASE, null );
|
||||||
new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
|
|
||||||
Metadata.Nature.RELEASE );
|
resolve( result, infos, RELEASE );
|
||||||
}
|
}
|
||||||
else if ( LATEST.equals( version ) )
|
else if ( LATEST.equals( version ) )
|
||||||
{
|
{
|
||||||
metadata =
|
Map<String, VersionInfo> infos =
|
||||||
new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
|
readVersionInfoMap( session, result, Metadata.Nature.RELEASE_OR_SNAPSHOT, null );
|
||||||
Metadata.Nature.RELEASE_OR_SNAPSHOT );
|
|
||||||
|
if ( !resolve( result, infos, LATEST ) )
|
||||||
|
{
|
||||||
|
resolve( result, infos, RELEASE );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) )
|
||||||
|
{
|
||||||
|
VersionRequest subRequest = new VersionRequest();
|
||||||
|
subRequest.setArtifact( artifact.setVersion( result.getVersion() ) );
|
||||||
|
if ( result.getRepository() instanceof RemoteRepository )
|
||||||
|
{
|
||||||
|
subRequest.setRepositories( Collections.singletonList( (RemoteRepository) result.getRepository() ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subRequest.setRepositories( request.getRepositories() );
|
||||||
|
}
|
||||||
|
VersionResult subResult = resolveVersion( session, subRequest );
|
||||||
|
result.setVersion( subResult.getVersion() );
|
||||||
|
result.setRepository( subResult.getRepository() );
|
||||||
|
for ( Exception exception : subResult.getExceptions() )
|
||||||
|
{
|
||||||
|
result.addException( exception );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( version.endsWith( SNAPSHOT ) )
|
else if ( version.endsWith( SNAPSHOT ) )
|
||||||
{
|
{
|
||||||
WorkspaceReader workspace = session.getWorkspaceReader();
|
WorkspaceReader workspace = session.getWorkspaceReader();
|
||||||
if ( workspace != null && workspace.findVersions( artifact ).contains( version ) )
|
if ( workspace != null && workspace.findVersions( artifact ).contains( version ) )
|
||||||
{
|
{
|
||||||
metadata = null;
|
result.setVersion( version );
|
||||||
result.setRepository( workspace.getRepository() );
|
result.setRepository( workspace.getRepository() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
metadata =
|
Map<String, VersionInfo> infos =
|
||||||
new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML,
|
readVersionInfoMap( session, result, Metadata.Nature.SNAPSHOT, version );
|
||||||
Metadata.Nature.SNAPSHOT );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
metadata = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( metadata == null )
|
|
||||||
{
|
|
||||||
result.setVersion( version );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>( request.getRepositories().size() );
|
|
||||||
|
|
||||||
metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
|
|
||||||
|
|
||||||
for ( RemoteRepository repository : request.getRepositories() )
|
|
||||||
{
|
|
||||||
MetadataRequest metadataRequest =
|
|
||||||
new MetadataRequest( metadata, repository, request.getRequestContext() );
|
|
||||||
metadataRequest.setDeleteLocalCopyIfMissing( true );
|
|
||||||
metadataRequest.setFavorLocalRepository( true );
|
|
||||||
metadataRequest.setTrace( trace );
|
|
||||||
metadataRequests.add( metadataRequest );
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataRequests );
|
|
||||||
|
|
||||||
Map<String, VersionInfo> infos = new HashMap<String, VersionInfo>();
|
|
||||||
|
|
||||||
for ( MetadataResult metadataResult : metadataResults )
|
|
||||||
{
|
|
||||||
result.addException( metadataResult.getException() );
|
|
||||||
|
|
||||||
ArtifactRepository repository = metadataResult.getRequest().getRepository();
|
|
||||||
if ( repository == null )
|
|
||||||
{
|
|
||||||
repository = session.getLocalRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
|
|
||||||
merge( artifact, infos, versioning, repository );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( RELEASE.equals( version ) )
|
|
||||||
{
|
|
||||||
resolve( result, infos, RELEASE );
|
|
||||||
}
|
|
||||||
else if ( LATEST.equals( version ) )
|
|
||||||
{
|
|
||||||
if ( !resolve( result, infos, LATEST ) )
|
|
||||||
{
|
|
||||||
resolve( result, infos, RELEASE );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) )
|
|
||||||
{
|
|
||||||
VersionRequest subRequest = new VersionRequest();
|
|
||||||
subRequest.setArtifact( artifact.setVersion( result.getVersion() ) );
|
|
||||||
if ( result.getRepository() instanceof RemoteRepository )
|
|
||||||
{
|
|
||||||
subRequest.setRepositories( Collections.singletonList( (RemoteRepository) result.getRepository() ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subRequest.setRepositories( request.getRepositories() );
|
|
||||||
}
|
|
||||||
VersionResult subResult = resolveVersion( session, subRequest );
|
|
||||||
result.setVersion( subResult.getVersion() );
|
|
||||||
result.setRepository( subResult.getRepository() );
|
|
||||||
for ( Exception exception : subResult.getExceptions() )
|
|
||||||
{
|
|
||||||
result.addException( exception );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String key = SNAPSHOT + getKey( artifact.getClassifier(), artifact.getExtension() );
|
String key = SNAPSHOT + getKey( artifact.getClassifier(), artifact.getExtension() );
|
||||||
|
|
||||||
merge( infos, SNAPSHOT, key );
|
merge( infos, SNAPSHOT, key );
|
||||||
|
|
||||||
if ( !resolve( result, infos, key ) )
|
if ( !resolve( result, infos, key ) )
|
||||||
{
|
{
|
||||||
result.setVersion( version );
|
result.setVersion( version );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.setVersion( version );
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( result.getVersion() ) )
|
return result;
|
||||||
{
|
|
||||||
throw new VersionResolutionException( result );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cacheKey != null && metadata != null && isSafelyCacheable( session, artifact ) )
|
if ( StringUtils.isEmpty( result.getVersion() ) )
|
||||||
|
{
|
||||||
|
throw new VersionResolutionException( result );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( cacheKey != null && isSafelyCacheable( session, artifact ) )
|
||||||
{
|
{
|
||||||
cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) );
|
cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) );
|
||||||
}
|
}
|
||||||
|
@ -297,6 +249,54 @@ public class DefaultVersionResolver
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, VersionInfo> readVersionInfoMap( RepositorySystemSession session, VersionResult result,
|
||||||
|
Metadata.Nature nature, String version )
|
||||||
|
{
|
||||||
|
VersionRequest request = result.getRequest();
|
||||||
|
Artifact artifact = request.getArtifact();
|
||||||
|
|
||||||
|
Metadata metadata =
|
||||||
|
new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version,
|
||||||
|
MavenMetadata.MAVEN_METADATA_XML, nature );
|
||||||
|
|
||||||
|
RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request );
|
||||||
|
|
||||||
|
List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>( request.getRepositories().size() + 1 );
|
||||||
|
|
||||||
|
metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
|
||||||
|
|
||||||
|
for ( RemoteRepository repository : request.getRepositories() )
|
||||||
|
{
|
||||||
|
MetadataRequest metadataRequest = new MetadataRequest( metadata, repository, request.getRequestContext() );
|
||||||
|
metadataRequest.setDeleteLocalCopyIfMissing( true );
|
||||||
|
metadataRequest.setFavorLocalRepository( true );
|
||||||
|
metadataRequest.setTrace( trace );
|
||||||
|
|
||||||
|
metadataRequests.add( metadataRequest );
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataRequests );
|
||||||
|
|
||||||
|
Map<String, VersionInfo> infos = new HashMap<String, VersionInfo>();
|
||||||
|
|
||||||
|
for ( MetadataResult metadataResult : metadataResults )
|
||||||
|
{
|
||||||
|
result.addException( metadataResult.getException() );
|
||||||
|
|
||||||
|
ArtifactRepository repository = metadataResult.getRequest().getRepository();
|
||||||
|
if ( repository == null )
|
||||||
|
{
|
||||||
|
repository = session.getLocalRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
|
||||||
|
|
||||||
|
merge( request.getArtifact(), infos, versioning, repository );
|
||||||
|
}
|
||||||
|
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean resolve( VersionResult result, Map<String, VersionInfo> infos, String key )
|
private boolean resolve( VersionResult result, Map<String, VersionInfo> infos, String key )
|
||||||
{
|
{
|
||||||
VersionInfo info = infos.get( key );
|
VersionInfo info = infos.get( key );
|
||||||
|
@ -313,50 +313,41 @@ public class DefaultVersionResolver
|
||||||
{
|
{
|
||||||
Versioning versioning = null;
|
Versioning versioning = null;
|
||||||
|
|
||||||
FileInputStream fis = null;
|
|
||||||
|
if ( metadata == null )
|
||||||
|
{
|
||||||
|
return new Versioning();
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncContext syncContext = syncContextFactory.newInstance( session, true );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( metadata != null )
|
syncContext.acquire( null, Collections.singleton( metadata ) );
|
||||||
|
|
||||||
|
versioning = MavenMetadata.read( metadata.getFile() ).getVersioning();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
|
||||||
|
* of the local repository. This is especially troublesome during snapshot resolution so we try
|
||||||
|
* to handle that gracefully.
|
||||||
|
*/
|
||||||
|
if ( versioning != null && repository instanceof LocalRepository )
|
||||||
{
|
{
|
||||||
SyncContext syncContext = syncContextFactory.newInstance( session, true );
|
Snapshot snapshot = versioning.getSnapshot();
|
||||||
|
if ( snapshot != null && snapshot.getBuildNumber() > 0 )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
syncContext.acquire( null, Collections.singleton( metadata ) );
|
Versioning repaired = new Versioning();
|
||||||
|
repaired.setLastUpdated( versioning.getLastUpdated() );
|
||||||
|
snapshot = new Snapshot();
|
||||||
|
snapshot.setLocalCopy( true );
|
||||||
|
repaired.setSnapshot( snapshot );
|
||||||
|
|
||||||
if ( metadata.getFile() != null && metadata.getFile().exists() )
|
versioning = repaired;
|
||||||
{
|
|
||||||
fis = new FileInputStream( metadata.getFile() );
|
|
||||||
org.apache.maven.artifact.repository.metadata.Metadata m =
|
|
||||||
new MetadataXpp3Reader().read( fis, false );
|
|
||||||
versioning = m.getVersioning();
|
|
||||||
|
|
||||||
/*
|
throw new IOException( "Snapshot information corrupted with remote repository data"
|
||||||
* NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
|
+ ", please verify that no remote repository uses the id '" + repository.getId()
|
||||||
* of the local repository. This is especially troublesome during snapshot resolution so we try
|
+ "'" );
|
||||||
* to handle that gracefully.
|
|
||||||
*/
|
|
||||||
if ( versioning != null && repository instanceof LocalRepository )
|
|
||||||
{
|
|
||||||
if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 )
|
|
||||||
{
|
|
||||||
Versioning repaired = new Versioning();
|
|
||||||
repaired.setLastUpdated( versioning.getLastUpdated() );
|
|
||||||
Snapshot snapshot = new Snapshot();
|
|
||||||
snapshot.setLocalCopy( true );
|
|
||||||
repaired.setSnapshot( snapshot );
|
|
||||||
versioning = repaired;
|
|
||||||
|
|
||||||
throw new IOException( "Snapshot information corrupted with remote repository data"
|
|
||||||
+ ", please verify that no remote repository uses the id '" + repository.getId()
|
|
||||||
+ "'" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
syncContext.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +358,7 @@ public class DefaultVersionResolver
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IOUtil.close( fis );
|
syncContext.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( versioning != null ) ? versioning : new Versioning();
|
return ( versioning != null ) ? versioning : new Versioning();
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -35,66 +34,38 @@ import org.sonatype.aether.artifact.Artifact;
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
final class LocalSnapshotMetadata
|
final class LocalSnapshotMetadata
|
||||||
extends MavenMetadata
|
extends MavenSnapshotMetadata
|
||||||
{
|
{
|
||||||
|
|
||||||
private final Collection<Artifact> artifacts = new ArrayList<Artifact>();
|
|
||||||
|
|
||||||
private final boolean legacyFormat;
|
|
||||||
|
|
||||||
public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat )
|
public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat )
|
||||||
{
|
{
|
||||||
super( createMetadata( artifact, legacyFormat ), null );
|
super( createLocalMetadata( artifact, legacyFormat ), null, legacyFormat );
|
||||||
this.legacyFormat = legacyFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
|
public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
|
||||||
{
|
{
|
||||||
super( metadata, file );
|
super( metadata, file, legacyFormat );
|
||||||
this.legacyFormat = legacyFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Metadata createMetadata( Artifact artifact, boolean legacyFormat )
|
private static Metadata createLocalMetadata( Artifact artifact, boolean legacyFormat )
|
||||||
{
|
{
|
||||||
|
Metadata metadata = createRepositoryMetadata( artifact, legacyFormat );
|
||||||
|
|
||||||
Snapshot snapshot = new Snapshot();
|
Snapshot snapshot = new Snapshot();
|
||||||
snapshot.setLocalCopy( true );
|
snapshot.setLocalCopy( true );
|
||||||
Versioning versioning = new Versioning();
|
Versioning versioning = new Versioning();
|
||||||
versioning.setSnapshot( snapshot );
|
versioning.setSnapshot( snapshot );
|
||||||
|
|
||||||
Metadata metadata = new Metadata();
|
|
||||||
metadata.setVersioning( versioning );
|
metadata.setVersioning( versioning );
|
||||||
metadata.setGroupId( artifact.getGroupId() );
|
|
||||||
metadata.setArtifactId( artifact.getArtifactId() );
|
|
||||||
metadata.setVersion( artifact.getBaseVersion() );
|
|
||||||
|
|
||||||
if ( !legacyFormat )
|
|
||||||
{
|
|
||||||
metadata.setModelVersion( "1.1.0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bind( Artifact artifact )
|
|
||||||
{
|
|
||||||
artifacts.add( artifact );
|
|
||||||
}
|
|
||||||
|
|
||||||
public MavenMetadata setFile( File file )
|
public MavenMetadata setFile( File file )
|
||||||
{
|
{
|
||||||
return new LocalSnapshotMetadata( metadata, file, legacyFormat );
|
return new LocalSnapshotMetadata( metadata, file, legacyFormat );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getKey()
|
|
||||||
{
|
|
||||||
return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getKey( Artifact artifact )
|
|
||||||
{
|
|
||||||
return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void merge( Metadata recessive )
|
protected void merge( Metadata recessive )
|
||||||
{
|
{
|
||||||
|
@ -135,29 +106,4 @@ final class LocalSnapshotMetadata
|
||||||
artifacts.clear();
|
artifacts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getKey( String classifier, String extension )
|
|
||||||
{
|
|
||||||
return classifier + ':' + extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroupId()
|
|
||||||
{
|
|
||||||
return metadata.getGroupId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArtifactId()
|
|
||||||
{
|
|
||||||
return metadata.getArtifactId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return metadata.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Nature getNature()
|
|
||||||
{
|
|
||||||
return Nature.SNAPSHOT;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ abstract class MavenMetadata
|
||||||
implements MergeableMetadata
|
implements MergeableMetadata
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
||||||
|
|
||||||
private final File file;
|
private final File file;
|
||||||
|
|
||||||
protected Metadata metadata;
|
protected Metadata metadata;
|
||||||
|
@ -55,7 +57,7 @@ abstract class MavenMetadata
|
||||||
|
|
||||||
public String getType()
|
public String getType()
|
||||||
{
|
{
|
||||||
return "maven-metadata.xml";
|
return MAVEN_METADATA_XML;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
|
@ -82,7 +84,7 @@ abstract class MavenMetadata
|
||||||
|
|
||||||
protected abstract void merge( Metadata recessive );
|
protected abstract void merge( Metadata recessive );
|
||||||
|
|
||||||
private Metadata read( File metadataFile )
|
static Metadata read( File metadataFile )
|
||||||
throws RepositoryException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
if ( metadataFile.length() <= 0 )
|
if ( metadataFile.length() <= 0 )
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.repository.metadata.Metadata;
|
||||||
|
import org.sonatype.aether.artifact.Artifact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
abstract class MavenSnapshotMetadata
|
||||||
|
extends MavenMetadata
|
||||||
|
{
|
||||||
|
static final String SNAPSHOT = "SNAPSHOT";
|
||||||
|
|
||||||
|
protected final Collection<Artifact> artifacts = new ArrayList<Artifact>();
|
||||||
|
|
||||||
|
protected final boolean legacyFormat;
|
||||||
|
|
||||||
|
protected MavenSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
|
||||||
|
{
|
||||||
|
super( metadata, file );
|
||||||
|
this.legacyFormat = legacyFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Metadata createRepositoryMetadata( Artifact artifact, boolean legacyFormat )
|
||||||
|
{
|
||||||
|
Metadata metadata = new Metadata();
|
||||||
|
if ( !legacyFormat )
|
||||||
|
{
|
||||||
|
metadata.setModelVersion( "1.1.0" );
|
||||||
|
}
|
||||||
|
metadata.setGroupId( artifact.getGroupId() );
|
||||||
|
metadata.setArtifactId( artifact.getArtifactId() );
|
||||||
|
metadata.setVersion( artifact.getBaseVersion() );
|
||||||
|
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bind( Artifact artifact )
|
||||||
|
{
|
||||||
|
artifacts.add( artifact );
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKey()
|
||||||
|
{
|
||||||
|
return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getKey( Artifact artifact )
|
||||||
|
{
|
||||||
|
return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getKey( String classifier, String extension )
|
||||||
|
{
|
||||||
|
return classifier + ':' + extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId()
|
||||||
|
{
|
||||||
|
return metadata.getGroupId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactId()
|
||||||
|
{
|
||||||
|
return metadata.getArtifactId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return metadata.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Nature getNature()
|
||||||
|
{
|
||||||
|
return Nature.SNAPSHOT;
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,6 @@ import java.io.File;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -39,46 +38,19 @@ import org.sonatype.aether.artifact.Artifact;
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
final class RemoteSnapshotMetadata
|
final class RemoteSnapshotMetadata
|
||||||
extends MavenMetadata
|
extends MavenSnapshotMetadata
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String SNAPSHOT = "SNAPSHOT";
|
|
||||||
|
|
||||||
private final Collection<Artifact> artifacts = new ArrayList<Artifact>();
|
|
||||||
|
|
||||||
private final Map<String, SnapshotVersion> versions = new LinkedHashMap<String, SnapshotVersion>();
|
private final Map<String, SnapshotVersion> versions = new LinkedHashMap<String, SnapshotVersion>();
|
||||||
|
|
||||||
private final boolean legacyFormat;
|
|
||||||
|
|
||||||
public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat )
|
public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat )
|
||||||
{
|
{
|
||||||
super( createMetadata( artifact, legacyFormat ), null );
|
super( createRepositoryMetadata( artifact, legacyFormat ), null, legacyFormat );
|
||||||
this.legacyFormat = legacyFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
|
private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
|
||||||
{
|
{
|
||||||
super( metadata, file );
|
super( metadata, file, legacyFormat );
|
||||||
this.legacyFormat = legacyFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Metadata createMetadata( Artifact artifact, boolean legacyFormat )
|
|
||||||
{
|
|
||||||
Metadata metadata = new Metadata();
|
|
||||||
if ( !legacyFormat )
|
|
||||||
{
|
|
||||||
metadata.setModelVersion( "1.1.0" );
|
|
||||||
}
|
|
||||||
metadata.setGroupId( artifact.getGroupId() );
|
|
||||||
metadata.setArtifactId( artifact.getArtifactId() );
|
|
||||||
metadata.setVersion( artifact.getBaseVersion() );
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bind( Artifact artifact )
|
|
||||||
{
|
|
||||||
artifacts.add( artifact );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenMetadata setFile( File file )
|
public MavenMetadata setFile( File file )
|
||||||
|
@ -86,16 +58,6 @@ final class RemoteSnapshotMetadata
|
||||||
return new RemoteSnapshotMetadata( metadata, file, legacyFormat );
|
return new RemoteSnapshotMetadata( metadata, file, legacyFormat );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getKey()
|
|
||||||
{
|
|
||||||
return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getKey( Artifact artifact )
|
|
||||||
{
|
|
||||||
return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExpandedVersion( Artifact artifact )
|
public String getExpandedVersion( Artifact artifact )
|
||||||
{
|
{
|
||||||
String key = getKey( artifact.getClassifier(), artifact.getExtension() );
|
String key = getKey( artifact.getClassifier(), artifact.getExtension() );
|
||||||
|
@ -136,7 +98,7 @@ final class RemoteSnapshotMetadata
|
||||||
|
|
||||||
if ( version.endsWith( SNAPSHOT ) )
|
if ( version.endsWith( SNAPSHOT ) )
|
||||||
{
|
{
|
||||||
String qualifier = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
|
String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber();
|
||||||
version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
|
version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +107,7 @@ final class RemoteSnapshotMetadata
|
||||||
sv.setExtension( artifact.getExtension() );
|
sv.setExtension( artifact.getExtension() );
|
||||||
sv.setVersion( version );
|
sv.setVersion( version );
|
||||||
sv.setUpdated( lastUpdated );
|
sv.setUpdated( lastUpdated );
|
||||||
|
|
||||||
versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
|
versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,11 +132,6 @@ final class RemoteSnapshotMetadata
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getKey( String classifier, String extension )
|
|
||||||
{
|
|
||||||
return classifier + ':' + extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getBuildNumber( Metadata metadata )
|
private static int getBuildNumber( Metadata metadata )
|
||||||
{
|
{
|
||||||
int number = 0;
|
int number = 0;
|
||||||
|
@ -191,24 +149,4 @@ final class RemoteSnapshotMetadata
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupId()
|
|
||||||
{
|
|
||||||
return metadata.getGroupId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArtifactId()
|
|
||||||
{
|
|
||||||
return metadata.getArtifactId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return metadata.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Nature getNature()
|
|
||||||
{
|
|
||||||
return Nature.SNAPSHOT;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,18 +40,22 @@ final class VersionsMetadata
|
||||||
|
|
||||||
public VersionsMetadata( Artifact artifact )
|
public VersionsMetadata( Artifact artifact )
|
||||||
{
|
{
|
||||||
super( createMetadata( artifact ), null );
|
super( createRepositoryMetadata( artifact ), null );
|
||||||
this.artifact = artifact;
|
this.artifact = artifact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VersionsMetadata( Artifact artifact, File file )
|
public VersionsMetadata( Artifact artifact, File file )
|
||||||
{
|
{
|
||||||
super( createMetadata( artifact ), file );
|
super( createRepositoryMetadata( artifact ), file );
|
||||||
this.artifact = artifact;
|
this.artifact = artifact;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Metadata createMetadata( Artifact artifact )
|
private static Metadata createRepositoryMetadata( Artifact artifact )
|
||||||
{
|
{
|
||||||
|
Metadata metadata = new Metadata();
|
||||||
|
metadata.setGroupId( artifact.getGroupId() );
|
||||||
|
metadata.setArtifactId( artifact.getArtifactId() );
|
||||||
|
|
||||||
Versioning versioning = new Versioning();
|
Versioning versioning = new Versioning();
|
||||||
versioning.addVersion( artifact.getBaseVersion() );
|
versioning.addVersion( artifact.getBaseVersion() );
|
||||||
if ( !artifact.isSnapshot() )
|
if ( !artifact.isSnapshot() )
|
||||||
|
@ -63,10 +67,7 @@ final class VersionsMetadata
|
||||||
versioning.setLatest( artifact.getBaseVersion() );
|
versioning.setLatest( artifact.getBaseVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata metadata = new Metadata();
|
|
||||||
metadata.setVersioning( versioning );
|
metadata.setVersioning( versioning );
|
||||||
metadata.setGroupId( artifact.getGroupId() );
|
|
||||||
metadata.setArtifactId( artifact.getArtifactId() );
|
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,76 @@
|
||||||
package org.apache.maven.repository.internal;
|
package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
||||||
import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
|
import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
|
||||||
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
|
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
import org.sonatype.aether.RepositorySystem;
|
import org.sonatype.aether.RepositorySystem;
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
import org.sonatype.aether.repository.LocalRepository;
|
import org.sonatype.aether.repository.LocalRepository;
|
||||||
import org.sonatype.aether.repository.RemoteRepository;
|
import org.sonatype.aether.repository.RemoteRepository;
|
||||||
|
|
||||||
public abstract class AbstractRepositoryTestCase
|
public abstract class AbstractRepositoryTestCase
|
||||||
extends PlexusTestCase
|
extends PlexusTestCase
|
||||||
{
|
{
|
||||||
protected RepositorySystem system;
|
protected RepositorySystem system;
|
||||||
|
|
||||||
protected RepositorySystemSession session;
|
protected RepositorySystemSession session;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
system = lookup( RepositorySystem.class );
|
system = lookup( RepositorySystem.class );
|
||||||
session = newMavenRepositorySystemSession( system );
|
session = newMavenRepositorySystemSession( system );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown()
|
protected void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
session = null;
|
session = null;
|
||||||
system = null;
|
system = null;
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
|
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
|
||||||
{
|
{
|
||||||
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
|
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
|
||||||
|
|
||||||
LocalRepository localRepo = new LocalRepository( "target/local-repo" );
|
LocalRepository localRepo = new LocalRepository( "target/local-repo" );
|
||||||
session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );
|
session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );
|
||||||
|
|
||||||
session.setTransferListener( new ConsoleTransferListener() );
|
session.setTransferListener( new ConsoleTransferListener() );
|
||||||
session.setRepositoryListener( new ConsoleRepositoryListener() );
|
session.setRepositoryListener( new ConsoleRepositoryListener() );
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RemoteRepository newTestRepository()
|
public static RemoteRepository newTestRepository()
|
||||||
throws MalformedURLException
|
throws MalformedURLException
|
||||||
{
|
{
|
||||||
return new RemoteRepository( "repo", "default",
|
return new RemoteRepository( "repo", "default",
|
||||||
getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() );
|
getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,96 +1,96 @@
|
||||||
package org.apache.maven.repository.internal;
|
package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.sonatype.aether.artifact.Artifact;
|
import org.sonatype.aether.artifact.Artifact;
|
||||||
import org.sonatype.aether.impl.VersionResolver;
|
import org.sonatype.aether.impl.VersionResolver;
|
||||||
import org.sonatype.aether.resolution.VersionRequest;
|
import org.sonatype.aether.resolution.VersionRequest;
|
||||||
import org.sonatype.aether.resolution.VersionResult;
|
import org.sonatype.aether.resolution.VersionResult;
|
||||||
import org.sonatype.aether.util.artifact.DefaultArtifact;
|
import org.sonatype.aether.util.artifact.DefaultArtifact;
|
||||||
|
|
||||||
public class DefaultVersionResolverTest
|
public class DefaultVersionResolverTest
|
||||||
extends AbstractRepositoryTestCase
|
extends AbstractRepositoryTestCase
|
||||||
{
|
{
|
||||||
private DefaultVersionResolver versionResolver;
|
private DefaultVersionResolver versionResolver;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// be sure we're testing the right class, i.e. DefaultVersionResolver.class
|
// be sure we're testing the right class, i.e. DefaultVersionResolver.class
|
||||||
versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
|
versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown()
|
protected void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
versionResolver = null;
|
versionResolver = null;
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
|
public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
VersionRequest requestB = new VersionRequest();
|
VersionRequest requestB = new VersionRequest();
|
||||||
requestB.addRepository( newTestRepository() );
|
requestB.addRepository( newTestRepository() );
|
||||||
Artifact artifactB =
|
Artifact artifactB =
|
||||||
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
|
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
|
||||||
requestB.setArtifact( artifactB );
|
requestB.setArtifact( artifactB );
|
||||||
|
|
||||||
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
|
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
|
||||||
assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
|
assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
|
||||||
|
|
||||||
VersionRequest requestA = new VersionRequest();
|
VersionRequest requestA = new VersionRequest();
|
||||||
requestA.addRepository( newTestRepository() );
|
requestA.addRepository( newTestRepository() );
|
||||||
|
|
||||||
Artifact artifactA =
|
Artifact artifactA =
|
||||||
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
|
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
|
||||||
requestA.setArtifact( artifactA );
|
requestA.setArtifact( artifactA );
|
||||||
|
|
||||||
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
|
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
|
||||||
assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
|
assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
|
public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
VersionRequest requestA = new VersionRequest();
|
VersionRequest requestA = new VersionRequest();
|
||||||
requestA.addRepository( newTestRepository() );
|
requestA.addRepository( newTestRepository() );
|
||||||
String versionA = "07.20.3-20120809.112124-88";
|
String versionA = "07.20.3-20120809.112124-88";
|
||||||
Artifact artifactA =
|
Artifact artifactA =
|
||||||
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
|
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
|
||||||
requestA.setArtifact( artifactA );
|
requestA.setArtifact( artifactA );
|
||||||
|
|
||||||
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
|
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
|
||||||
assertEquals( versionA, resultA.getVersion() );
|
assertEquals( versionA, resultA.getVersion() );
|
||||||
|
|
||||||
VersionRequest requestB = new VersionRequest();
|
VersionRequest requestB = new VersionRequest();
|
||||||
requestB.addRepository( newTestRepository() );
|
requestB.addRepository( newTestRepository() );
|
||||||
String versionB = "07.20.3-20120809.112920-97";
|
String versionB = "07.20.3-20120809.112920-97";
|
||||||
Artifact artifactB =
|
Artifact artifactB =
|
||||||
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
|
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
|
||||||
requestB.setArtifact( artifactB );
|
requestB.setArtifact( artifactB );
|
||||||
|
|
||||||
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
|
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
|
||||||
assertEquals( versionB, resultB.getVersion() );
|
assertEquals( versionB, resultB.getVersion() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||||
~ or more contributor license agreements. See the NOTICE file
|
~ or more contributor license agreements. See the NOTICE file
|
||||||
~ distributed with this work for additional information
|
~ distributed with this work for additional information
|
||||||
~ regarding copyright ownership. The ASF licenses this file
|
~ regarding copyright ownership. The ASF licenses this file
|
||||||
~ to you under the Apache License, Version 2.0 (the
|
~ to you under the Apache License, Version 2.0 (the
|
||||||
~ "License"); you may not use this file except in compliance
|
~ "License"); you may not use this file except in compliance
|
||||||
~ with the License. You may obtain a copy of the License at
|
~ with the License. You may obtain a copy of the License at
|
||||||
~
|
~
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~
|
~
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
~ software distributed under the License is distributed on an
|
~ software distributed under the License is distributed on an
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
~ KIND, either express or implied. See the License for the
|
~ KIND, either express or implied. See the License for the
|
||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
|
xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
|
||||||
modelVersion="1.1.0">
|
modelVersion="1.1.0">
|
||||||
<groupId>org.apache.maven.its</groupId>
|
<groupId>org.apache.maven.its</groupId>
|
||||||
<artifactId>dep-mng5324</artifactId>
|
<artifactId>dep-mng5324</artifactId>
|
||||||
<version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
|
<version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
|
||||||
<versioning>
|
<versioning>
|
||||||
<snapshot>
|
<snapshot>
|
||||||
<timestamp>20120809.112920</timestamp>
|
<timestamp>20120809.112920</timestamp>
|
||||||
<buildNumber>97</buildNumber>
|
<buildNumber>97</buildNumber>
|
||||||
</snapshot>
|
</snapshot>
|
||||||
<lastUpdated>20120809112920</lastUpdated>
|
<lastUpdated>20120809112920</lastUpdated>
|
||||||
<snapshotVersions>
|
<snapshotVersions>
|
||||||
<snapshotVersion>
|
<snapshotVersion>
|
||||||
<classifier>classifierA</classifier>
|
<classifier>classifierA</classifier>
|
||||||
<extension>jar</extension>
|
<extension>jar</extension>
|
||||||
<value>07.20.3-20120809.112124-88</value>
|
<value>07.20.3-20120809.112124-88</value>
|
||||||
<updated>20120809112124</updated>
|
<updated>20120809112124</updated>
|
||||||
</snapshotVersion>
|
</snapshotVersion>
|
||||||
<snapshotVersion>
|
<snapshotVersion>
|
||||||
<classifier>classifierB</classifier>
|
<classifier>classifierB</classifier>
|
||||||
<extension>jar</extension>
|
<extension>jar</extension>
|
||||||
<value>07.20.3-20120809.112920-97</value>
|
<value>07.20.3-20120809.112920-97</value>
|
||||||
<updated>20120809112920</updated>
|
<updated>20120809112920</updated>
|
||||||
</snapshotVersion>
|
</snapshotVersion>
|
||||||
</snapshotVersions>
|
</snapshotVersions>
|
||||||
</versioning>
|
</versioning>
|
||||||
</metadata>
|
</metadata>
|
|
@ -32,6 +32,10 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
|
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
|
||||||
import org.apache.maven.artifact.versioning.VersionRange;
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maven Artifact interface. Notice that it mixes artifact definition concepts (groupId, artifactId, version)
|
||||||
|
* with dependency information (version range, scope).
|
||||||
|
*/
|
||||||
public interface Artifact
|
public interface Artifact
|
||||||
extends Comparable<Artifact>
|
extends Comparable<Artifact>
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.artifact.repository;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a set of policies for a repository to use under certain conditions.
|
* Describes a set of policies for a repository to use under certain conditions.
|
||||||
|
|
|
@ -69,9 +69,9 @@ public class ComparableVersion
|
||||||
|
|
||||||
private interface Item
|
private interface Item
|
||||||
{
|
{
|
||||||
final int INTEGER_ITEM = 0;
|
int INTEGER_ITEM = 0;
|
||||||
final int STRING_ITEM = 1;
|
int STRING_ITEM = 1;
|
||||||
final int LIST_ITEM = 2;
|
int LIST_ITEM = 2;
|
||||||
|
|
||||||
int compareTo( Item item );
|
int compareTo( Item item );
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class ComparableVersion
|
||||||
private static class IntegerItem
|
private static class IntegerItem
|
||||||
implements Item
|
implements Item
|
||||||
{
|
{
|
||||||
private static final BigInteger BigInteger_ZERO = new BigInteger( "0" );
|
private static final BigInteger BIG_INTEGER_ZERO = new BigInteger( "0" );
|
||||||
|
|
||||||
private final BigInteger value;
|
private final BigInteger value;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class ComparableVersion
|
||||||
|
|
||||||
private IntegerItem()
|
private IntegerItem()
|
||||||
{
|
{
|
||||||
this.value = BigInteger_ZERO;
|
this.value = BIG_INTEGER_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntegerItem( String str )
|
public IntegerItem( String str )
|
||||||
|
@ -109,14 +109,14 @@ public class ComparableVersion
|
||||||
|
|
||||||
public boolean isNull()
|
public boolean isNull()
|
||||||
{
|
{
|
||||||
return BigInteger_ZERO.equals( value );
|
return BIG_INTEGER_ZERO.equals( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo( Item item )
|
public int compareTo( Item item )
|
||||||
{
|
{
|
||||||
if ( item == null )
|
if ( item == null )
|
||||||
{
|
{
|
||||||
return BigInteger_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
return BIG_INTEGER_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( item.getType() )
|
switch ( item.getType() )
|
||||||
|
@ -266,7 +266,7 @@ public class ComparableVersion
|
||||||
|
|
||||||
void normalize()
|
void normalize()
|
||||||
{
|
{
|
||||||
for( ListIterator<Item> iterator = listIterator( size() ); iterator.hasPrevious(); )
|
for ( ListIterator<Item> iterator = listIterator( size() ); iterator.hasPrevious(); )
|
||||||
{
|
{
|
||||||
Item item = iterator.previous();
|
Item item = iterator.previous();
|
||||||
if ( item.isNull() )
|
if ( item.isNull() )
|
||||||
|
@ -327,7 +327,7 @@ public class ComparableVersion
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder buffer = new StringBuilder( "(" );
|
StringBuilder buffer = new StringBuilder( "(" );
|
||||||
for( Iterator<Item> iter = iterator(); iter.hasNext(); )
|
for ( Iterator<Item> iter = iterator(); iter.hasNext(); )
|
||||||
{
|
{
|
||||||
buffer.append( iter.next() );
|
buffer.append( iter.next() );
|
||||||
if ( iter.hasNext() )
|
if ( iter.hasNext() )
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class DefaultArtifactVersion
|
||||||
{
|
{
|
||||||
if ( otherVersion instanceof DefaultArtifactVersion )
|
if ( otherVersion instanceof DefaultArtifactVersion )
|
||||||
{
|
{
|
||||||
return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion).comparable );
|
return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion ).comparable );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,7 +108,7 @@ public enum ArtifactScopeEnum
|
||||||
{
|
{
|
||||||
final ArtifactScopeEnum s = checkScope( scope );
|
final ArtifactScopeEnum s = checkScope( scope );
|
||||||
|
|
||||||
// system scope is historic only - and simple
|
// system scope is historic only - and simple
|
||||||
if ( id == system.id )
|
if ( id == system.id )
|
||||||
{
|
{
|
||||||
return scope.id == system.id;
|
return scope.id == system.id;
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.artifact.repository.metadata;
|
package org.apache.maven.artifact.repository.metadata;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 java.io.File;
|
import java.io.File;
|
||||||
|
@ -47,7 +51,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
@Component(role=RepositoryMetadataManager.class)
|
@Component( role = RepositoryMetadataManager.class )
|
||||||
public class DefaultRepositoryMetadataManager
|
public class DefaultRepositoryMetadataManager
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements RepositoryMetadataManager
|
implements RepositoryMetadataManager
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.io.File;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.sonatype.aether.RepositoryException;
|
import org.sonatype.aether.RepositoryException;
|
||||||
import org.sonatype.aether.metadata.MergeableMetadata;
|
import org.sonatype.aether.metadata.MergeableMetadata;
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.artifact.resolver;
|
package org.apache.maven.artifact.resolver;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 java.io.File;
|
import java.io.File;
|
||||||
|
@ -65,7 +69,7 @@ import org.sonatype.aether.resolution.ArtifactResult;
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
@Component(role = ArtifactResolver.class)
|
@Component( role = ArtifactResolver.class )
|
||||||
public class DefaultArtifactResolver
|
public class DefaultArtifactResolver
|
||||||
implements ArtifactResolver
|
implements ArtifactResolver
|
||||||
{
|
{
|
||||||
|
@ -111,7 +115,8 @@ public class DefaultArtifactResolver
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
executor =
|
executor =
|
||||||
new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator());
|
new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
|
||||||
|
new DaemonThreadCreator() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,19 +156,22 @@ public class DefaultArtifactResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, TransferListener resolutionListener )
|
public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactRepository localRepository, TransferListener resolutionListener )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
resolve( artifact, remoteRepositories, getSession( localRepository ) );
|
resolve( artifact, remoteRepositories, getSession( localRepository ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
|
public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
resolve( artifact, remoteRepositories, getSession( localRepository ) );
|
resolve( artifact, remoteRepositories, getSession( localRepository ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, RepositorySystemSession session )
|
private void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||||
|
RepositorySystemSession session )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
if ( artifact == null )
|
if ( artifact == null )
|
||||||
|
@ -249,52 +257,73 @@ public class DefaultArtifactResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
|
ArtifactRepository localRepository,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
ArtifactMetadataSource source, ArtifactFilter filter )
|
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter );
|
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
|
||||||
|
remoteRepositories, source, filter );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source )
|
Map managedVersions, ArtifactRepository localRepository,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactMetadataSource source )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null );
|
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
|
||||||
|
remoteRepositories, source, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter )
|
Map managedVersions, ArtifactRepository localRepository,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null );
|
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
|
||||||
|
remoteRepositories, source, filter, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactRepository localRepository,
|
||||||
ArtifactMetadataSource source )
|
ArtifactMetadataSource source )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null );
|
return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
ArtifactMetadataSource source, List<ResolutionListener> listeners )
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactRepository localRepository,
|
||||||
|
ArtifactMetadataSource source,
|
||||||
|
List<ResolutionListener> listeners )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
|
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
|
||||||
remoteRepositories, source, null, listeners );
|
remoteRepositories, source, null, listeners );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners )
|
Map managedVersions, ArtifactRepository localRepository,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||||
|
List<ResolutionListener> listeners )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null );
|
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
|
||||||
|
remoteRepositories, source, filter, listeners, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
|
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||||
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
|
Map managedVersions, ArtifactRepository localRepository,
|
||||||
|
List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||||
|
List<ResolutionListener> listeners,
|
||||||
List<ConflictResolver> conflictResolvers )
|
List<ConflictResolver> conflictResolvers )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
|
@ -336,7 +365,7 @@ public class DefaultArtifactResolver
|
||||||
{
|
{
|
||||||
Artifact rootArtifact = request.getArtifact();
|
Artifact rootArtifact = request.getArtifact();
|
||||||
Set<Artifact> artifacts = request.getArtifactDependencies();
|
Set<Artifact> artifacts = request.getArtifactDependencies();
|
||||||
Map managedVersions = request.getManagedVersionMap();
|
Map<String, Artifact> managedVersions = request.getManagedVersionMap();
|
||||||
List<ResolutionListener> listeners = request.getListeners();
|
List<ResolutionListener> listeners = request.getListeners();
|
||||||
ArtifactFilter collectionFilter = request.getCollectionFilter();
|
ArtifactFilter collectionFilter = request.getCollectionFilter();
|
||||||
ArtifactFilter resolutionFilter = request.getResolutionFilter();
|
ArtifactFilter resolutionFilter = request.getResolutionFilter();
|
||||||
|
@ -528,18 +557,18 @@ public class DefaultArtifactResolver
|
||||||
/**
|
/**
|
||||||
* ThreadCreator for creating daemon threads with fixed ThreadGroup-name.
|
* ThreadCreator for creating daemon threads with fixed ThreadGroup-name.
|
||||||
*/
|
*/
|
||||||
final static class DaemonThreadCreator
|
static final class DaemonThreadCreator
|
||||||
implements ThreadFactory
|
implements ThreadFactory
|
||||||
{
|
{
|
||||||
static final String THREADGROUP_NAME = "org.apache.maven.artifact.resolver.DefaultArtifactResolver";
|
static final String THREADGROUP_NAME = "org.apache.maven.artifact.resolver.DefaultArtifactResolver";
|
||||||
|
|
||||||
final static ThreadGroup group = new ThreadGroup( THREADGROUP_NAME );
|
static final ThreadGroup GROUP = new ThreadGroup( THREADGROUP_NAME );
|
||||||
|
|
||||||
final static AtomicInteger threadNumber = new AtomicInteger( 1 );
|
static final AtomicInteger THREAD_NUMBER = new AtomicInteger( 1 );
|
||||||
|
|
||||||
public Thread newThread( Runnable r )
|
public Thread newThread( Runnable r )
|
||||||
{
|
{
|
||||||
Thread newThread = new Thread( group, r, "resolver-" + threadNumber.getAndIncrement() );
|
Thread newThread = new Thread( GROUP, r, "resolver-" + THREAD_NUMBER.getAndIncrement() );
|
||||||
newThread.setDaemon( true );
|
newThread.setDaemon( true );
|
||||||
return newThread;
|
return newThread;
|
||||||
}
|
}
|
||||||
|
@ -574,6 +603,7 @@ public class DefaultArtifactResolver
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
ClassLoader old = Thread.currentThread().getContextClassLoader();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Thread.currentThread().setContextClassLoader( classLoader );
|
Thread.currentThread().setContextClassLoader( classLoader );
|
||||||
|
@ -602,6 +632,8 @@ public class DefaultArtifactResolver
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
|
Thread.currentThread().setContextClassLoader( old );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,10 @@ package org.apache.maven.profiles;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.model.Activation;
|
import org.apache.maven.model.Activation;
|
||||||
import org.apache.maven.model.InputLocation;
|
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.building.ModelProblem;
|
import org.apache.maven.model.building.ModelProblem;
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
|
||||||
import org.apache.maven.model.profile.DefaultProfileActivationContext;
|
import org.apache.maven.model.profile.DefaultProfileActivationContext;
|
||||||
import org.apache.maven.model.profile.ProfileActivationContext;
|
|
||||||
import org.apache.maven.model.profile.ProfileSelector;
|
import org.apache.maven.model.profile.ProfileSelector;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
import org.codehaus.plexus.MutablePlexusContainer;
|
import org.codehaus.plexus.MutablePlexusContainer;
|
||||||
|
@ -36,13 +33,11 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SystemPropertyProfileActivator
|
||||||
+ profile.getId() + "'" );
|
+ profile.getId() + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( name.startsWith("!") )
|
if ( name.startsWith( "!" ) )
|
||||||
{
|
{
|
||||||
reverseName = true;
|
reverseName = true;
|
||||||
name = name.substring( 1 );
|
name = name.substring( 1 );
|
||||||
|
|
|
@ -283,7 +283,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
pathTranslator ) );
|
pathTranslator ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings( "unchecked" )
|
||||||
protected String interpolateInternal( String src, List<ValueSource> valueSources,
|
protected String interpolateInternal( String src, List<ValueSource> valueSources,
|
||||||
List<InterpolationPostProcessor> postProcessors, boolean debug )
|
List<InterpolationPostProcessor> postProcessors, boolean debug )
|
||||||
throws ModelInterpolationException
|
throws ModelInterpolationException
|
||||||
|
@ -296,7 +296,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
Logger logger = getLogger();
|
Logger logger = getLogger();
|
||||||
|
|
||||||
String result = src;
|
String result = src;
|
||||||
synchronized( this )
|
synchronized ( this )
|
||||||
{
|
{
|
||||||
|
|
||||||
for ( ValueSource vs : valueSources )
|
for ( ValueSource vs : valueSources )
|
||||||
|
@ -315,7 +315,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
{
|
{
|
||||||
result = interpolator.interpolate( result, recursionInterceptor );
|
result = interpolator.interpolate( result, recursionInterceptor );
|
||||||
}
|
}
|
||||||
catch( InterpolationException e )
|
catch ( InterpolationException e )
|
||||||
{
|
{
|
||||||
throw new ModelInterpolationException( e.getMessage(), e );
|
throw new ModelInterpolationException( e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,11 @@ package org.apache.maven.project.validation;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.maven.model.InputLocation;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.building.DefaultModelBuildingRequest;
|
import org.apache.maven.model.building.DefaultModelBuildingRequest;
|
||||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||||
import org.apache.maven.model.building.ModelProblem;
|
import org.apache.maven.model.building.ModelProblem;
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class MetadataGraphNode
|
||||||
|
|
||||||
public MetadataGraphNode()
|
public MetadataGraphNode()
|
||||||
{
|
{
|
||||||
inNodes = new ArrayList<MetadataGraphNode>(4);
|
inNodes = new ArrayList<MetadataGraphNode>( 4 );
|
||||||
exNodes = new ArrayList<MetadataGraphNode>(8);
|
exNodes = new ArrayList<MetadataGraphNode>( 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataGraphNode( MavenArtifactMetadata metadata )
|
public MetadataGraphNode( MavenArtifactMetadata metadata )
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class DefaultArtifactRepositoryFactory
|
||||||
private String globalChecksumPolicy;
|
private String globalChecksumPolicy;
|
||||||
|
|
||||||
@Requirement( role = ArtifactRepositoryLayout.class )
|
@Requirement( role = ArtifactRepositoryLayout.class )
|
||||||
private Map<String,ArtifactRepositoryLayout> repositoryLayouts;
|
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
|
||||||
|
|
||||||
public ArtifactRepositoryLayout getLayout( String layoutId )
|
public ArtifactRepositoryLayout getLayout( String layoutId )
|
||||||
throws UnknownRepositoryLayoutException
|
throws UnknownRepositoryLayoutException
|
||||||
|
|
|
@ -63,10 +63,10 @@ import org.codehaus.plexus.logging.Logger;
|
||||||
public class DefaultLegacyArtifactCollector
|
public class DefaultLegacyArtifactCollector
|
||||||
implements LegacyArtifactCollector
|
implements LegacyArtifactCollector
|
||||||
{
|
{
|
||||||
@Requirement(hint="nearest")
|
@Requirement( hint = "nearest" )
|
||||||
private ConflictResolver defaultConflictResolver;
|
private ConflictResolver defaultConflictResolver;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
|
|
|
@ -38,18 +38,17 @@ public interface ArtifactTransformation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
|
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
|
||||||
* transformation has occured the original artifact is returned.
|
* transformation has occurred the original artifact is returned.
|
||||||
*
|
*
|
||||||
* @param artifact Artifact to be transformed.
|
* @param artifact Artifact to be transformed.
|
||||||
* @param request the repositories to check
|
* @param request the repositories to check
|
||||||
* @param localRepository the local repository
|
|
||||||
*/
|
*/
|
||||||
void transformForResolve( Artifact artifact, RepositoryRequest request )
|
void transformForResolve( Artifact artifact, RepositoryRequest request )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
|
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
|
||||||
* transformation has occured the original artifact is returned.
|
* transformation has occurred the original artifact is returned.
|
||||||
*
|
*
|
||||||
* @param artifact Artifact to be transformed.
|
* @param artifact Artifact to be transformed.
|
||||||
* @param remoteRepositories the repositories to check
|
* @param remoteRepositories the repositories to check
|
||||||
|
@ -62,7 +61,7 @@ public interface ArtifactTransformation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take in a artifact and return the transformed artifact for locating in the local repository. If no
|
* Take in a artifact and return the transformed artifact for locating in the local repository. If no
|
||||||
* transformation has occured the original artifact is returned.
|
* transformation has occurred the original artifact is returned.
|
||||||
*
|
*
|
||||||
* @param artifact Artifact to be transformed.
|
* @param artifact Artifact to be transformed.
|
||||||
* @param localRepository the local repository it will be stored in
|
* @param localRepository the local repository it will be stored in
|
||||||
|
@ -72,8 +71,8 @@ public interface ArtifactTransformation
|
||||||
throws ArtifactInstallationException;
|
throws ArtifactInstallationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take in a artifact and return the transformed artifact for distributing toa remote repository. If no
|
* Take in a artifact and return the transformed artifact for distributing to remote repository. If no
|
||||||
* transformation has occured the original artifact is returned.
|
* transformation has occurred the original artifact is returned.
|
||||||
*
|
*
|
||||||
* @param artifact Artifact to be transformed.
|
* @param artifact Artifact to be transformed.
|
||||||
* @param remoteRepository the repository to deploy to
|
* @param remoteRepository the repository to deploy to
|
||||||
|
|
|
@ -40,7 +40,6 @@ public interface ArtifactTransformationManager
|
||||||
*
|
*
|
||||||
* @param artifact Artifact to be transformed.
|
* @param artifact Artifact to be transformed.
|
||||||
* @param request the repositories to check
|
* @param request the repositories to check
|
||||||
* @param localRepository the local repository
|
|
||||||
*/
|
*/
|
||||||
void transformForResolve( Artifact artifact, RepositoryRequest request )
|
void transformForResolve( Artifact artifact, RepositoryRequest request )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.maven.artifact.ArtifactScopeEnum;
|
||||||
* Artifact Metadata that is resolved independent of Artifact itself.
|
* Artifact Metadata that is resolved independent of Artifact itself.
|
||||||
*
|
*
|
||||||
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
|
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ArtifactMetadata
|
public class ArtifactMetadata
|
||||||
{
|
{
|
||||||
|
@ -291,7 +290,7 @@ public class ArtifactMetadata
|
||||||
return artifactExists;
|
return artifactExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArtifactExists(boolean artifactExists)
|
public void setArtifactExists( boolean artifactExists )
|
||||||
{
|
{
|
||||||
this.artifactExists = artifactExists;
|
this.artifactExists = artifactExists;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +301,7 @@ public class ArtifactMetadata
|
||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDependencies(Collection<ArtifactMetadata> dependencies)
|
public void setDependencies( Collection<ArtifactMetadata> dependencies )
|
||||||
{
|
{
|
||||||
this.dependencies = dependencies;
|
this.dependencies = dependencies;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +311,7 @@ public class ArtifactMetadata
|
||||||
return artifactUri;
|
return artifactUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArtifactUri(String artifactUri)
|
public void setArtifactUri( String artifactUri )
|
||||||
{
|
{
|
||||||
this.artifactUri = artifactUri;
|
this.artifactUri = artifactUri;
|
||||||
}
|
}
|
||||||
|
@ -322,23 +321,28 @@ public class ArtifactMetadata
|
||||||
{
|
{
|
||||||
return why;
|
return why;
|
||||||
}
|
}
|
||||||
public void setWhy(String why)
|
|
||||||
|
public void setWhy( String why )
|
||||||
{
|
{
|
||||||
this.why = why;
|
this.why = why;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
public String getError()
|
public String getError()
|
||||||
{
|
{
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
public void setError(String error)
|
|
||||||
|
public void setError( String error )
|
||||||
{
|
{
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isError()
|
public boolean isError()
|
||||||
{
|
{
|
||||||
return error == null;
|
return error == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
public String getDependencyConflictId()
|
public String getDependencyConflictId()
|
||||||
{
|
{
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class MetadataGraph
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
public List<MetadataGraphEdge> getEdgesBetween( MetadataGraphVertex vFrom, MetadataGraphVertex vTo )
|
public List<MetadataGraphEdge> getEdgesBetween( MetadataGraphVertex vFrom, MetadataGraphVertex vTo )
|
||||||
{
|
{
|
||||||
List<MetadataGraphEdge> edges = getIncidentEdges(vTo);
|
List<MetadataGraphEdge> edges = getIncidentEdges( vTo );
|
||||||
if ( edges == null || edges.isEmpty() )
|
if ( edges == null || edges.isEmpty() )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -125,10 +125,10 @@ public class MetadataGraphEdge
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResolved()
|
public boolean isResolved()
|
||||||
{
|
{
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResolved( boolean resolved )
|
public void setResolved( boolean resolved )
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ public class MetadataGraphEdge
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "[ " + "FROM:("
|
return "[ " + "FROM:("
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MetadataResolution
|
||||||
return artifactMetadata;
|
return artifactMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArtifactMetadata(ArtifactMetadata artifactMetadata)
|
public void setArtifactMetadata( ArtifactMetadata artifactMetadata )
|
||||||
{
|
{
|
||||||
this.artifactMetadata = artifactMetadata;
|
this.artifactMetadata = artifactMetadata;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,73 +124,62 @@
|
||||||
</models>
|
</models>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>create-noncanonicalrev</id>
|
||||||
|
<goals>
|
||||||
|
<goal>create-timestamp</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<timestampFormat>'NON-CANONICAL_'yyyy-MM-dd_HH-mm_'${user.name}'</timestampFormat>
|
||||||
|
<timestampPropertyName>nonCanonicalRevision</timestampPropertyName>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>create-buildnumber</id>
|
||||||
|
<goals>
|
||||||
|
<goal>create</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<doCheck>false</doCheck>
|
||||||
|
<doUpdate>false</doUpdate>
|
||||||
|
<revisionOnScmFailure>${nonCanonicalRevision}</revisionOnScmFailure>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.eclipse.m2e</groupId>
|
||||||
|
<artifactId>lifecycle-mapping</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<configuration>
|
||||||
|
<lifecycleMappingMetadata>
|
||||||
|
<pluginExecutions>
|
||||||
|
<pluginExecution>
|
||||||
|
<pluginExecutionFilter>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||||
|
<versionRange>[1.2,)</versionRange>
|
||||||
|
<goals>
|
||||||
|
<goal>create-timestamp</goal>
|
||||||
|
</goals>
|
||||||
|
</pluginExecutionFilter>
|
||||||
|
<action>
|
||||||
|
<ignore></ignore>
|
||||||
|
</action>
|
||||||
|
</pluginExecution>
|
||||||
|
</pluginExecutions>
|
||||||
|
</lifecycleMappingMetadata>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>svn-buildnumber</id>
|
|
||||||
<activation>
|
|
||||||
<file>
|
|
||||||
<exists>.svn</exists>
|
|
||||||
</file>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>generate-resources</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>create</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<doCheck>false</doCheck>
|
|
||||||
<doUpdate>false</doUpdate>
|
|
||||||
<providerImplementations>
|
|
||||||
<svn>javasvn</svn>
|
|
||||||
</providerImplementations>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>non-canonical-buildnumber</id>
|
|
||||||
<activation>
|
|
||||||
<file>
|
|
||||||
<missing>.svn</missing>
|
|
||||||
</file>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>generate-resources</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>create</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<doCheck>false</doCheck>
|
|
||||||
<doUpdate>false</doUpdate>
|
|
||||||
<format>NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1}</format>
|
|
||||||
<items>
|
|
||||||
<item>timestamp</item>
|
|
||||||
<item>${user.name}</item>
|
|
||||||
</items>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -85,8 +85,10 @@ import org.sonatype.aether.RepositorySystem;
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
import org.sonatype.aether.repository.Authentication;
|
import org.sonatype.aether.repository.Authentication;
|
||||||
import org.sonatype.aether.repository.LocalRepository;
|
import org.sonatype.aether.repository.LocalRepository;
|
||||||
|
import org.sonatype.aether.repository.NoLocalRepositoryManagerException;
|
||||||
import org.sonatype.aether.repository.RepositoryPolicy;
|
import org.sonatype.aether.repository.RepositoryPolicy;
|
||||||
import org.sonatype.aether.repository.WorkspaceReader;
|
import org.sonatype.aether.repository.WorkspaceReader;
|
||||||
|
import org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory;
|
||||||
import org.sonatype.aether.util.DefaultRepositorySystemSession;
|
import org.sonatype.aether.util.DefaultRepositorySystemSession;
|
||||||
import org.sonatype.aether.util.repository.ChainedWorkspaceReader;
|
import org.sonatype.aether.util.repository.ChainedWorkspaceReader;
|
||||||
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
||||||
|
@ -128,6 +130,9 @@ public class DefaultMaven
|
||||||
@Requirement
|
@Requirement
|
||||||
private RepositorySystem repoSystem;
|
private RepositorySystem repoSystem;
|
||||||
|
|
||||||
|
@Requirement( optional = true, hint = "simple" )
|
||||||
|
private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private SettingsDecrypter settingsDecrypter;
|
private SettingsDecrypter settingsDecrypter;
|
||||||
|
|
||||||
|
@ -352,7 +357,25 @@ public class DefaultMaven
|
||||||
session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
|
session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
|
||||||
|
|
||||||
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
|
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
|
||||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
|
|
||||||
|
if ( request.isUseLegacyLocalRepository() )
|
||||||
|
{
|
||||||
|
logger.warn( "Disabling enhanced local repository: using legacy is stronlgy discouraged to ensure build reproducibility." );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( localRepo ) );
|
||||||
|
}
|
||||||
|
catch ( NoLocalRepositoryManagerException e )
|
||||||
|
{
|
||||||
|
|
||||||
|
logger.warn( "Failed to configure legacy local repository: back to default" );
|
||||||
|
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( request.getWorkspaceReader() != null )
|
if ( request.getWorkspaceReader() != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,6 +143,8 @@ public class DefaultMavenExecutionRequest
|
||||||
*/
|
*/
|
||||||
private boolean noSnapshotUpdates;
|
private boolean noSnapshotUpdates;
|
||||||
|
|
||||||
|
private boolean useSimpleLocalRepositoryManager = false;
|
||||||
|
|
||||||
public DefaultMavenExecutionRequest()
|
public DefaultMavenExecutionRequest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1076,4 +1078,14 @@ public class DefaultMavenExecutionRequest
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUseLegacyLocalRepository()
|
||||||
|
{
|
||||||
|
return this.useSimpleLocalRepositoryManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MavenExecutionRequest setUseLegacyLocalRepository( boolean useSimpleLocalRepositoryManager )
|
||||||
|
{
|
||||||
|
this.useSimpleLocalRepositoryManager = useSimpleLocalRepositoryManager;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.execution;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -39,7 +38,7 @@ public class DefaultMavenExecutionResult
|
||||||
|
|
||||||
private DependencyResolutionResult dependencyResolutionResult;
|
private DependencyResolutionResult dependencyResolutionResult;
|
||||||
|
|
||||||
private List<Throwable> exceptions = new CopyOnWriteArrayList<Throwable>( );
|
private List<Throwable> exceptions = new CopyOnWriteArrayList<Throwable>();
|
||||||
|
|
||||||
private Map<MavenProject, BuildSummary> buildSummaries;
|
private Map<MavenProject, BuildSummary> buildSummaries;
|
||||||
|
|
||||||
|
|
|
@ -45,45 +45,45 @@ public interface MavenExecutionRequest
|
||||||
// Logging
|
// Logging
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
final int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
|
int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
|
||||||
|
|
||||||
final int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
|
int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
|
||||||
|
|
||||||
final int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
|
int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
|
||||||
|
|
||||||
final int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
|
int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
|
||||||
|
|
||||||
final int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
|
int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
|
||||||
|
|
||||||
final int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
|
int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Reactor Failure Mode
|
// Reactor Failure Mode
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
final String REACTOR_FAIL_FAST = "FAIL_FAST";
|
String REACTOR_FAIL_FAST = "FAIL_FAST";
|
||||||
|
|
||||||
final String REACTOR_FAIL_AT_END = "FAIL_AT_END";
|
String REACTOR_FAIL_AT_END = "FAIL_AT_END";
|
||||||
|
|
||||||
final String REACTOR_FAIL_NEVER = "FAIL_NEVER";
|
String REACTOR_FAIL_NEVER = "FAIL_NEVER";
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Reactor Make Mode
|
// Reactor Make Mode
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
final String REACTOR_MAKE_UPSTREAM = "make-upstream";
|
String REACTOR_MAKE_UPSTREAM = "make-upstream";
|
||||||
|
|
||||||
final String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
|
String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
|
||||||
|
|
||||||
final String REACTOR_MAKE_BOTH = "make-both";
|
String REACTOR_MAKE_BOTH = "make-both";
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Artifact repository policies
|
// Artifact repository policies
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
final String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
|
String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
|
||||||
|
|
||||||
final String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
|
String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -283,4 +283,14 @@ public interface MavenExecutionRequest
|
||||||
|
|
||||||
ProjectBuildingRequest getProjectBuildingRequest();
|
ProjectBuildingRequest getProjectBuildingRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
boolean isUseLegacyLocalRepository();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepository );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder
|
* Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @author Kristian Rosenvold
|
* @author Kristian Rosenvold
|
||||||
* Builds one or more lifecycles for a full module
|
* Builds one or more lifecycles for a full module
|
||||||
|
@ -134,7 +134,8 @@ public class BuilderCommon
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession,
|
public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession,
|
||||||
final MavenProject mavenProject, Exception e, final long buildStartTime )
|
final MavenSession currentSession, final MavenProject mavenProject, Exception e,
|
||||||
|
final long buildStartTime )
|
||||||
{
|
{
|
||||||
if ( e instanceof RuntimeException )
|
if ( e instanceof RuntimeException )
|
||||||
{
|
{
|
||||||
|
@ -147,7 +148,7 @@ public class BuilderCommon
|
||||||
|
|
||||||
buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) );
|
buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) );
|
||||||
|
|
||||||
eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, rootSession, null, e );
|
eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, currentSession, null, e );
|
||||||
|
|
||||||
if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) )
|
if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) )
|
||||||
{
|
{
|
||||||
|
@ -186,5 +187,4 @@ public class BuilderCommon
|
||||||
return project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion();
|
return project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -29,17 +29,16 @@ package org.apache.maven.lifecycle.internal;
|
||||||
*/
|
*/
|
||||||
class CurrentPhaseForThread
|
class CurrentPhaseForThread
|
||||||
{
|
{
|
||||||
private static final InheritableThreadLocal<String> threadPhase = new InheritableThreadLocal<String>();
|
private static final InheritableThreadLocal<String> THREAD_PHASE = new InheritableThreadLocal<String>();
|
||||||
|
|
||||||
|
|
||||||
public static void setPhase( String phase )
|
public static void setPhase( String phase )
|
||||||
{
|
{
|
||||||
threadPhase.set( phase );
|
THREAD_PHASE.set( phase );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPhase( String phase )
|
public static boolean isPhase( String phase )
|
||||||
{
|
{
|
||||||
return phase.equals( threadPhase.get() );
|
return phase.equals( THREAD_PHASE.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.lifecycle.internal;
|
package org.apache.maven.lifecycle.internal;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -219,11 +224,10 @@ public class DefaultLifecycleExecutionPlanCalculator
|
||||||
|
|
||||||
if ( lifecycle == null )
|
if ( lifecycle == null )
|
||||||
{
|
{
|
||||||
throw new LifecyclePhaseNotFoundException(
|
throw new LifecyclePhaseNotFoundException( "Unknown lifecycle phase \"" + lifecyclePhase
|
||||||
"Unknown lifecycle phase \"" + lifecyclePhase + "\". You must specify a valid lifecycle phase" +
|
+ "\". You must specify a valid lifecycle phase" + " or a goal in the format <plugin-prefix>:<goal> or"
|
||||||
" or a goal in the format <plugin-prefix>:<goal> or" +
|
+ " <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: "
|
||||||
" <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: " +
|
+ defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase );
|
||||||
defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -432,8 +436,8 @@ public class DefaultLifecycleExecutionPlanCalculator
|
||||||
{
|
{
|
||||||
parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() );
|
parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() );
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) &&
|
if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) )
|
||||||
StringUtils.isNotEmpty( parameter.getImplementation() ) )
|
&& StringUtils.isNotEmpty( parameter.getImplementation() ) )
|
||||||
{
|
{
|
||||||
parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() );
|
parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,8 @@ public class DefaultLifecyclePluginAnalyzer
|
||||||
{
|
{
|
||||||
if ( logger.isDebugEnabled() )
|
if ( logger.isDebugEnabled() )
|
||||||
{
|
{
|
||||||
logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from " +
|
logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from "
|
||||||
Thread.currentThread().getContextClassLoader() );
|
+ Thread.currentThread().getContextClassLoader() );
|
||||||
}
|
}
|
||||||
|
|
||||||
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
|
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
|
||||||
|
|
|
@ -94,8 +94,8 @@ public class ExecutionPlanItem
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}' +
|
return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}'
|
||||||
super.toString();
|
+ super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,33 @@
|
||||||
package org.apache.maven.lifecycle.internal;
|
package org.apache.maven.lifecycle.internal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* 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
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
* software distributed under the License is distributed on an
|
||||||
* or implied. See the License for the specific language governing permissions and limitations under
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* the License.
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
import org.apache.maven.artifact.ArtifactUtils;
|
||||||
|
@ -37,8 +50,6 @@ import org.sonatype.aether.graph.DependencyNode;
|
||||||
import org.sonatype.aether.util.filter.AndDependencyFilter;
|
import org.sonatype.aether.util.filter.AndDependencyFilter;
|
||||||
import org.sonatype.aether.util.filter.ScopeDependencyFilter;
|
import org.sonatype.aether.util.filter.ScopeDependencyFilter;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves dependencies for the artifacts in context of the lifecycle build
|
* Resolves dependencies for the artifacts in context of the lifecycle build
|
||||||
*
|
*
|
||||||
|
@ -49,7 +60,7 @@ import java.util.*;
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
|
* NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
|
||||||
*/
|
*/
|
||||||
@Component(role = LifecycleDependencyResolver.class)
|
@Component( role = LifecycleDependencyResolver.class )
|
||||||
public class LifecycleDependencyResolver
|
public class LifecycleDependencyResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds one or more lifecycles for a full module
|
* Builds one or more lifecycles for a full module
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
|
@ -92,7 +92,7 @@ public class LifecycleModuleBuilder
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
builderCommon.handleBuildError( reactorContext, rootSession, currentProject, e, buildStartTime );
|
builderCommon.handleBuildError( reactorContext, rootSession, session, currentProject, e, buildStartTime );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -101,4 +101,4 @@ public class LifecycleModuleBuilder
|
||||||
Thread.currentThread().setContextClassLoader( reactorContext.getOriginalContextClassLoader() );
|
Thread.currentThread().setContextClassLoader( reactorContext.getOriginalContextClassLoader() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,8 @@ public class LifecycleWeaveBuilder
|
||||||
{
|
{
|
||||||
Iterator<ExecutionPlanItem> planItems = executionPlan.iterator();
|
Iterator<ExecutionPlanItem> planItems = executionPlan.iterator();
|
||||||
ExecutionPlanItem current = planItems.hasNext() ? planItems.next() : null;
|
ExecutionPlanItem current = planItems.hasNext() ? planItems.next() : null;
|
||||||
ThreadLockedArtifact threadLockedArtifact = (ThreadLockedArtifact)projectBuild.getProject().getArtifact();
|
ThreadLockedArtifact threadLockedArtifact =
|
||||||
|
(ThreadLockedArtifact) projectBuild.getProject().getArtifact();
|
||||||
if ( threadLockedArtifact != null )
|
if ( threadLockedArtifact != null )
|
||||||
{
|
{
|
||||||
threadLockedArtifact.attachToThread();
|
threadLockedArtifact.attachToThread();
|
||||||
|
@ -277,8 +278,8 @@ public class LifecycleWeaveBuilder
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getProject(), e,
|
builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getSession(),
|
||||||
buildStartTime );
|
projectBuild.getProject(), e, buildStartTime );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -375,13 +376,14 @@ public class LifecycleWeaveBuilder
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isThreadLockedAndEmpty(Artifact artifact){
|
private static boolean isThreadLockedAndEmpty( Artifact artifact )
|
||||||
return artifact instanceof ThreadLockedArtifact && !((ThreadLockedArtifact) artifact).hasReal();
|
{
|
||||||
|
return artifact instanceof ThreadLockedArtifact && !( (ThreadLockedArtifact) artifact ).hasReal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Artifact findDependency( MavenProject project, Artifact upStreamArtifact )
|
private static Artifact findDependency( MavenProject project, Artifact upStreamArtifact )
|
||||||
{
|
{
|
||||||
if ( upStreamArtifact == null || isThreadLockedAndEmpty(upStreamArtifact))
|
if ( upStreamArtifact == null || isThreadLockedAndEmpty( upStreamArtifact ) )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -483,8 +485,6 @@ public class LifecycleWeaveBuilder
|
||||||
artifactInThis.setFile( upstream.getFile() );
|
artifactInThis.setFile( upstream.getFile() );
|
||||||
artifactInThis.setRepository( upstream.getRepository() );
|
artifactInThis.setRepository( upstream.getRepository() );
|
||||||
artifactInThis.setResolved( true ); // Or maybe upstream.isResolved()....
|
artifactInThis.setResolved( true ); // Or maybe upstream.isResolved()....
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ class ThreadLockedArtifact
|
||||||
|
|
||||||
public boolean hasReal()
|
public boolean hasReal()
|
||||||
{
|
{
|
||||||
return real != null &&
|
return real != null
|
||||||
( !( real instanceof ThreadLockedArtifact ) || ( (ThreadLockedArtifact) real ).hasReal() );
|
&& ( !( real instanceof ThreadLockedArtifact ) || ( (ThreadLockedArtifact) real ).hasReal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupId()
|
public String getGroupId()
|
||||||
|
@ -96,17 +96,17 @@ class ThreadLockedArtifact
|
||||||
return real.hasClassifier();
|
return real.hasClassifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final InheritableThreadLocal<ThreadLockedArtifact> threadArtifact =
|
private static final InheritableThreadLocal<ThreadLockedArtifact> THREAD_ARTIFACT =
|
||||||
new InheritableThreadLocal<ThreadLockedArtifact>();
|
new InheritableThreadLocal<ThreadLockedArtifact>();
|
||||||
|
|
||||||
public void attachToThread()
|
public void attachToThread()
|
||||||
{
|
{
|
||||||
threadArtifact.set( this );
|
THREAD_ARTIFACT.set( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
final ThreadLockedArtifact lockedArtifact = threadArtifact.get();
|
final ThreadLockedArtifact lockedArtifact = THREAD_ARTIFACT.get();
|
||||||
if ( lockedArtifact != null && this != lockedArtifact && mustLock() )
|
if ( lockedArtifact != null && this != lockedArtifact && mustLock() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -66,9 +66,9 @@ public class DefaultLifecycleBindingsInjector
|
||||||
|
|
||||||
if ( defaultPlugins == null )
|
if ( defaultPlugins == null )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Unknown packaging: " + packaging )
|
.setMessage( "Unknown packaging: " + packaging )
|
||||||
.setLocation( model.getLocation( "packaging" )));
|
.setLocation( model.getLocation( "packaging" ) ) );
|
||||||
}
|
}
|
||||||
else if ( !defaultPlugins.isEmpty() )
|
else if ( !defaultPlugins.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ public class DefaultLifecycleBindingsInjector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LifecycleBindingsMerger
|
protected static class LifecycleBindingsMerger
|
||||||
extends MavenModelMerger
|
extends MavenModelMerger
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.plugin;
|
package org.apache.maven.plugin;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.plugin;
|
package org.apache.maven.plugin;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -33,7 +37,7 @@ import org.sonatype.aether.repository.RemoteRepository;
|
||||||
// TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works
|
// TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works
|
||||||
// TODO: remove the coreArtifactFilterManager
|
// TODO: remove the coreArtifactFilterManager
|
||||||
|
|
||||||
@Component(role = BuildPluginManager.class)
|
@Component( role = BuildPluginManager.class )
|
||||||
public class DefaultBuildPluginManager
|
public class DefaultBuildPluginManager
|
||||||
implements BuildPluginManager
|
implements BuildPluginManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,8 +53,8 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
||||||
* <tr><td><code>mojo.*</code></td> <td>(since Maven 3)</td><td></td></tr>
|
* <tr><td><code>mojo.*</code></td> <td>(since Maven 3)</td><td></td></tr>
|
||||||
* <tr><td><code>plugin</code></td> <td>(since Maven 3)</td><td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor() getPluginDescriptor()}</td></tr>
|
* <tr><td><code>plugin</code></td> <td>(since Maven 3)</td><td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor() getPluginDescriptor()}</td></tr>
|
||||||
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
||||||
* <tr><td>system properties</td> <td></td> <td></td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
|
||||||
* <tr><td>project properties</td> <td></td> <td></td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
* <i>Notice:</i> <code>reports</code> was supported in Maven 2.x but was removed in Maven 3
|
* <i>Notice:</i> <code>reports</code> was supported in Maven 2.x but was removed in Maven 3
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,9 +19,11 @@ package org.apache.maven.plugin.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.plugin.LegacySupport;
|
import org.apache.maven.plugin.LegacySupport;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,29 +39,30 @@ public class DefaultLegacySupport
|
||||||
implements LegacySupport
|
implements LegacySupport
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final ThreadLocal<MavenSession[]> session = new InheritableThreadLocal<MavenSession[]>();
|
private static final ThreadLocal<AtomicReference<MavenSession>> SESSION = new InheritableThreadLocal<AtomicReference<MavenSession>>();
|
||||||
|
|
||||||
public void setSession( MavenSession session )
|
public void setSession( MavenSession session )
|
||||||
{
|
{
|
||||||
if ( session == null )
|
AtomicReference<MavenSession> reference = DefaultLegacySupport.SESSION.get();
|
||||||
|
if ( reference != null )
|
||||||
{
|
{
|
||||||
MavenSession[] oldSession = DefaultLegacySupport.session.get();
|
reference.set( null );
|
||||||
if ( oldSession != null )
|
}
|
||||||
{
|
|
||||||
oldSession[0] = null;
|
if ( session == null && reference != null )
|
||||||
DefaultLegacySupport.session.remove();
|
{
|
||||||
}
|
DefaultLegacySupport.SESSION.remove();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DefaultLegacySupport.session.set( new MavenSession[] { session } );
|
DefaultLegacySupport.SESSION.set( new AtomicReference<MavenSession>( session ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenSession getSession()
|
public MavenSession getSession()
|
||||||
{
|
{
|
||||||
MavenSession[] currentSession = DefaultLegacySupport.session.get();
|
AtomicReference<MavenSession> currentSession = DefaultLegacySupport.SESSION.get();
|
||||||
return currentSession != null ? currentSession[0] : null;
|
return currentSession != null ? currentSession.get() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RepositorySystemSession getRepositorySession()
|
public RepositorySystemSession getRepositorySession()
|
||||||
|
|
|
@ -83,6 +83,7 @@ import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||||
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
||||||
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
|
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.codehaus.plexus.logging.LoggerManager;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
import org.codehaus.plexus.util.ReaderFactory;
|
import org.codehaus.plexus.util.ReaderFactory;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -110,6 +111,9 @@ public class DefaultMavenPluginManager
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private LoggerManager loggerManager;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private PlexusContainer container;
|
private PlexusContainer container;
|
||||||
|
|
||||||
|
@ -508,7 +512,8 @@ public class DefaultMavenPluginManager
|
||||||
|
|
||||||
if ( mojo instanceof Mojo )
|
if ( mojo instanceof Mojo )
|
||||||
{
|
{
|
||||||
( (Mojo) mojo ).setLog( new DefaultLog( logger ) );
|
Logger mojoLogger = loggerManager.getLoggerForComponent( mojoDescriptor.getImplementation() );
|
||||||
|
( (Mojo) mojo ).setLog( new DefaultLog( mojoLogger ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Xpp3Dom dom = mojoExecution.getConfiguration();
|
Xpp3Dom dom = mojoExecution.getConfiguration();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public interface PluginDependenciesResolver
|
||||||
* @return The resolved plugin artifact, never {@code null}.
|
* @return The resolved plugin artifact, never {@code null}.
|
||||||
* @throws PluginResolutionException If the plugin artifact could not be resolved.
|
* @throws PluginResolutionException If the plugin artifact could not be resolved.
|
||||||
*/
|
*/
|
||||||
public Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
|
Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
|
||||||
throws PluginResolutionException;
|
throws PluginResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.apache.maven.plugin.prefix;
|
package org.apache.maven.plugin.prefix;
|
||||||
|
|
||||||
import org.sonatype.aether.repository.ArtifactRepository;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -11,7 +9,7 @@ import org.sonatype.aether.repository.ArtifactRepository;
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
|
@ -21,6 +19,8 @@ import org.sonatype.aether.repository.ArtifactRepository;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.sonatype.aether.repository.ArtifactRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the result of a plugin prefix resolution request.
|
* Describes the result of a plugin prefix resolution request.
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,9 +97,9 @@ class DefaultModelBuildingListener
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Invalid plugin repository: " + e.getMessage() )
|
.setMessage( "Invalid plugin repository: " + e.getMessage() )
|
||||||
.setException( e ));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
project.setPluginArtifactRepositories( pluginRepositories );
|
project.setPluginArtifactRepositories( pluginRepositories );
|
||||||
|
|
||||||
|
@ -115,15 +115,15 @@ class DefaultModelBuildingListener
|
||||||
}
|
}
|
||||||
catch ( PluginResolutionException e )
|
catch ( PluginResolutionException e )
|
||||||
{
|
{
|
||||||
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Unresolveable build extension: " + e.getMessage())
|
.setMessage( "Unresolveable build extension: " + e.getMessage() )
|
||||||
.setException( e ));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
catch ( PluginVersionResolutionException e )
|
catch ( PluginVersionResolutionException e )
|
||||||
{
|
{
|
||||||
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Unresolveable build extension: " + e.getMessage() )
|
.setMessage( "Unresolveable build extension: " + e.getMessage() )
|
||||||
.setException( e ));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
projectBuildingHelper.selectProjectRealm( project );
|
projectBuildingHelper.selectProjectRealm( project );
|
||||||
|
@ -138,9 +138,9 @@ class DefaultModelBuildingListener
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Invalid artifact repository: " + e.getMessage() )
|
.setMessage( "Invalid artifact repository: " + e.getMessage() )
|
||||||
.setException( e ));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
project.setRemoteArtifactRepositories( remoteRepositories );
|
project.setRemoteArtifactRepositories( remoteRepositories );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.project;
|
package org.apache.maven.project;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven.project;
|
package org.apache.maven.project;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* distributed with this work for additional information
|
||||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* copy of the License at
|
* to you under the Apache License, Version 2.0 (the
|
||||||
*
|
* "License"); you may not use this file except in compliance
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* the License.
|
* 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 org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
|
@ -1477,7 +1481,7 @@ public class MavenProject
|
||||||
for ( int ax = 0; ax < attachedArtifacts.size(); ax++ )
|
for ( int ax = 0; ax < attachedArtifacts.size(); ax++ )
|
||||||
{
|
{
|
||||||
Artifact a = attachedArtifacts.get( ax );
|
Artifact a = attachedArtifacts.get( ax );
|
||||||
if ( a.equals( artifact ))
|
if ( a.equals( artifact ) )
|
||||||
{
|
{
|
||||||
if ( logger != null )
|
if ( logger != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,7 +79,7 @@ public interface ProjectBuildingRequest
|
||||||
*/
|
*/
|
||||||
Properties getUserProperties();
|
Properties getUserProperties();
|
||||||
|
|
||||||
void setProject(MavenProject mavenProject);
|
void setProject( MavenProject mavenProject );
|
||||||
|
|
||||||
MavenProject getProject();
|
MavenProject getProject();
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,17 @@ import org.sonatype.aether.RepositorySystemSession;
|
||||||
*/
|
*/
|
||||||
public interface RepositorySystem
|
public interface RepositorySystem
|
||||||
{
|
{
|
||||||
final String DEFAULT_LOCAL_REPO_ID = "local";
|
String DEFAULT_LOCAL_REPO_ID = "local";
|
||||||
|
|
||||||
final String userHome = System.getProperty( "user.home" );
|
String userHome = System.getProperty( "user.home" );
|
||||||
|
|
||||||
final File userMavenConfigurationHome = new File( userHome, ".m2" );
|
File userMavenConfigurationHome = new File( userHome, ".m2" );
|
||||||
|
|
||||||
final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" );
|
File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" );
|
||||||
|
|
||||||
final String DEFAULT_REMOTE_REPO_ID = "central";
|
String DEFAULT_REMOTE_REPO_ID = "central";
|
||||||
|
|
||||||
final String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2";
|
String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2";
|
||||||
|
|
||||||
Artifact createArtifact( String groupId, String artifactId, String version, String packaging );
|
Artifact createArtifact( String groupId, String artifactId, String version, String packaging );
|
||||||
|
|
||||||
|
|
|
@ -129,10 +129,10 @@ under the License.
|
||||||
</phases>
|
</phases>
|
||||||
<default-phases>
|
<default-phases>
|
||||||
<site>
|
<site>
|
||||||
org.apache.maven.plugins:maven-site-plugin:3.1:site
|
org.apache.maven.plugins:maven-site-plugin:3.2:site
|
||||||
</site>
|
</site>
|
||||||
<site-deploy>
|
<site-deploy>
|
||||||
org.apache.maven.plugins:maven-site-plugin:3.1:deploy
|
org.apache.maven.plugins:maven-site-plugin:3.2:deploy
|
||||||
</site-deploy>
|
</site-deploy>
|
||||||
</default-phases>
|
</default-phases>
|
||||||
<!-- END SNIPPET: site -->
|
<!-- END SNIPPET: site -->
|
||||||
|
|
|
@ -258,7 +258,7 @@ Mappings to default lifecycle, specific for each packaging.
|
||||||
org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
|
org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
|
||||||
</test>
|
</test>
|
||||||
<package>
|
<package>
|
||||||
org.apache.maven.plugins:maven-war-plugin:2.3:war
|
org.apache.maven.plugins:maven-war-plugin:2.2:war
|
||||||
</package>
|
</package>
|
||||||
<install>
|
<install>
|
||||||
org.apache.maven.plugins:maven-install-plugin:2.4:install
|
org.apache.maven.plugins:maven-install-plugin:2.4:install
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
---
|
---
|
||||||
Default Artifact Handlers Reference
|
Default Artifact Handlers Reference
|
||||||
---
|
---
|
||||||
Hervé Boutemy
|
Hervé Boutemy
|
||||||
---
|
---
|
||||||
2012-08-13
|
2012-08-13
|
||||||
---
|
---
|
||||||
|
|
||||||
Default Artifact Handlers Reference
|
Default Artifact Handlers Reference
|
||||||
|
|
||||||
Some artifact handlers are defined by default:
|
Some artifact handlers are defined by default:
|
||||||
|
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
|| type || extension || packaging || classifier || language || added to classpath || includesDependencies ||
|
|| type || extension || packaging || classifier || language || added to classpath || includesDependencies ||
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<pom>>> | <= type> | <= type> | | none | | |
|
| <<<pom>>> | <= type> | <= type> | | none | | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<jar>>> | <= type> | <= type> | | java | <<<true>>> | |
|
| <<<jar>>> | <= type> | <= type> | | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<maven-plugin>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
|
| <<<maven-plugin>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<ejb>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
|
| <<<ejb>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<ejb3>>> | <= type> | <= type> | | java | | <<<true>>> |
|
| <<<ejb3>>> | <= type> | <= type> | | java | | <<<true>>> |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<war>>> | <= type> | <= type> | | java | | <<<true>>> |
|
| <<<war>>> | <= type> | <= type> | | java | | <<<true>>> |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<ear>>> | <= type> | <= type> | | java | | <<<true>>> |
|
| <<<ear>>> | <= type> | <= type> | | java | | <<<true>>> |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<rar>>> | <= type> | <= type> | | java | | <<<true>>> |
|
| <<<rar>>> | <= type> | <= type> | | java | | <<<true>>> |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<par>>> | <= type> | <= type> | | java | | <<<true>>> |
|
| <<<par>>> | <= type> | <= type> | | java | | <<<true>>> |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<java-source>>> | <<<jar>>> | <= type> | <<<sources>>> | java | | |
|
| <<<java-source>>> | <<<jar>>> | <= type> | <<<sources>>> | java | | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<javadoc>>> | <<<jar>>> | <= type> | <<<javadoc>>> | java | <<<true>>> | |
|
| <<<javadoc>>> | <<<jar>>> | <= type> | <<<javadoc>>> | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<ejb-client>>> | <<<jar>>> | <<<ejb>>> | <<<client>>> | java | <<<true>>> | |
|
| <<<ejb-client>>> | <<<jar>>> | <<<ejb>>> | <<<client>>> | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
| <<<test-jar>>> | <<<jar>>> | <<<jar>>> | <<<tests>>> | java | <<<true>>> | |
|
| <<<test-jar>>> | <<<jar>>> | <<<jar>>> | <<<tests>>> | java | <<<true>>> | |
|
||||||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|
||||||
|
|
|
@ -26,4 +26,10 @@ Maven Core
|
||||||
({{{./xref/org/apache/maven/plugin/internal/DefaultMavenPluginManager.html}source}}),
|
({{{./xref/org/apache/maven/plugin/internal/DefaultMavenPluginManager.html}source}}),
|
||||||
|
|
||||||
* {{{./apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html}PluginParameterExpressionEvaluator}}, used to
|
* {{{./apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html}PluginParameterExpressionEvaluator}}, used to
|
||||||
evaluate plugin parameters values during Mojo configuration.
|
evaluate plugin parameters values during Mojo configuration,
|
||||||
|
|
||||||
|
* {{{/guides/mini/guide-maven-classloading.html}classloader hierarchy}} done by <<<ClassRealmManager>>> component
|
||||||
|
({{{./apidocs/org/apache/maven/classrealm/ClassRealmManager.html}javadoc}}),
|
||||||
|
with its <<<DefaultClassRealmManager>>> implementation
|
||||||
|
({{{./xref/org/apache/maven/classrealm/DefaultClassRealmManager.html}source}}), using
|
||||||
|
{{{http://plexus.codehaus.org/plexus-classworlds/}Plexus Classworlds}}.
|
||||||
|
|
|
@ -1,89 +1,89 @@
|
||||||
package org.apache.maven.artifact.handler;
|
package org.apache.maven.artifact.handler;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
public class ArtifactHandlerTest
|
public class ArtifactHandlerTest
|
||||||
extends PlexusTestCase
|
extends PlexusTestCase
|
||||||
{
|
{
|
||||||
public void testAptConsistency()
|
public void testAptConsistency()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
|
File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
List<String> lines = FileUtils.loadFile( apt );
|
List<String> lines = FileUtils.loadFile( apt );
|
||||||
|
|
||||||
for ( String line : lines )
|
for ( String line : lines )
|
||||||
{
|
{
|
||||||
if ( line.startsWith( "||" ) )
|
if ( line.startsWith( "||" ) )
|
||||||
{
|
{
|
||||||
String[] cols = line.split( "\\|\\|" );
|
String[] cols = line.split( "\\|\\|" );
|
||||||
String[] expected =
|
String[] expected =
|
||||||
new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath",
|
new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath",
|
||||||
"includesDependencies", "" };
|
"includesDependencies", "" };
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for ( String col : cols )
|
for ( String col : cols )
|
||||||
{
|
{
|
||||||
assertEquals( "Wrong column header", expected[i++], col.trim() );
|
assertEquals( "Wrong column header", expected[i++], col.trim() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( line.startsWith( "|" ) )
|
else if ( line.startsWith( "|" ) )
|
||||||
{
|
{
|
||||||
String[] cols = line.split( "\\|" );
|
String[] cols = line.split( "\\|" );
|
||||||
|
|
||||||
String type = trimApt( cols[1] );
|
String type = trimApt( cols[1] );
|
||||||
String extension = trimApt( cols[2], type );
|
String extension = trimApt( cols[2], type );
|
||||||
String packaging = trimApt( cols[3], type );
|
String packaging = trimApt( cols[3], type );
|
||||||
String classifier = trimApt( cols[4] );
|
String classifier = trimApt( cols[4] );
|
||||||
String language = trimApt( cols[5] );
|
String language = trimApt( cols[5] );
|
||||||
String addedToClasspath = trimApt( cols[6] );
|
String addedToClasspath = trimApt( cols[6] );
|
||||||
String includesDependencies = trimApt( cols[7] );
|
String includesDependencies = trimApt( cols[7] );
|
||||||
|
|
||||||
ArtifactHandler handler = lookup( ArtifactHandler.class, type );
|
ArtifactHandler handler = lookup( ArtifactHandler.class, type );
|
||||||
assertEquals( type + " extension", handler.getExtension(), extension );
|
assertEquals( type + " extension", handler.getExtension(), extension );
|
||||||
assertEquals( type + " packaging", handler.getPackaging(), packaging );
|
assertEquals( type + " packaging", handler.getPackaging(), packaging );
|
||||||
assertEquals( type + " classifier", handler.getClassifier(), classifier );
|
assertEquals( type + " classifier", handler.getClassifier(), classifier );
|
||||||
assertEquals( type + " language", handler.getLanguage(), language );
|
assertEquals( type + " language", handler.getLanguage(), language );
|
||||||
assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath );
|
assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath );
|
||||||
assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies );
|
assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String trimApt( String content, String type )
|
private String trimApt( String content, String type )
|
||||||
{
|
{
|
||||||
String value = trimApt( content );
|
String value = trimApt( content );
|
||||||
return "= type".equals( value ) ? type : value;
|
return "= type".equals( value ) ? type : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String trimApt( String content )
|
private String trimApt( String content )
|
||||||
{
|
{
|
||||||
content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim();
|
content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim();
|
||||||
|
|
||||||
return ( content.length() == 0 ) ? null : content;
|
return ( content.length() == 0 ) ? null : content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
package org.apache.maven.exception;
|
package org.apache.maven.exception;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
|
* @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
|
||||||
*/
|
*/
|
||||||
public class DefaultExceptionHandlerTest
|
public class DefaultExceptionHandlerTest
|
||||||
extends TestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Running Maven under JDK7 may cause connection issues because IPv6 is used by default.
|
* Running Maven under JDK7 may cause connection issues because IPv6 is used by default.
|
||||||
* <p>
|
* <p>
|
||||||
* e.g running mvn site:run will cause Jetty to fail.
|
* e.g running mvn site:run will cause Jetty to fail.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in
|
* The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in
|
||||||
* http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
|
* http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void testJdk7ipv6()
|
public void testJdk7ipv6()
|
||||||
{
|
{
|
||||||
ConnectException connEx = new ConnectException( "Connection refused: connect" );
|
ConnectException connEx = new ConnectException( "Connection refused: connect" );
|
||||||
IOException ioEx = new IOException( "Unable to establish loopback connection" );
|
IOException ioEx = new IOException( "Unable to establish loopback connection" );
|
||||||
ioEx.initCause( connEx );
|
ioEx.initCause( connEx );
|
||||||
MojoExecutionException mojoEx =
|
MojoExecutionException mojoEx =
|
||||||
new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
|
new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
|
||||||
|
|
||||||
ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
|
ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
|
||||||
ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx );
|
ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx );
|
||||||
|
|
||||||
String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
|
String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
|
||||||
assertEquals( expectedReference, exceptionSummary.getReference() );
|
assertEquals( expectedReference, exceptionSummary.getReference() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package org.apache.maven.plugin.internal;
|
||||||
|
/*
|
||||||
|
* 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 junit.framework.TestCase;
|
||||||
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kristian Rosenvold
|
||||||
|
*/
|
||||||
|
public class DefaultLegacySupportTest extends TestCase {
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
final DefaultLegacySupport defaultLegacySupport = new DefaultLegacySupport();
|
||||||
|
|
||||||
|
public void testSetSession() throws Exception {
|
||||||
|
|
||||||
|
MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
|
||||||
|
MavenSession m1 = new MavenSession(null, null, mavenExecutionRequest, null);
|
||||||
|
defaultLegacySupport.setSession(m1);
|
||||||
|
|
||||||
|
MyRunnable myRunnable = new MyRunnable();
|
||||||
|
Thread thread = new Thread(myRunnable);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
|
MavenSession m2 = new MavenSession(null, null, mavenExecutionRequest, null);
|
||||||
|
defaultLegacySupport.setSession(m2);
|
||||||
|
latch.countDown();
|
||||||
|
thread.join();
|
||||||
|
assertNull( myRunnable.getSession());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MyRunnable implements Runnable {
|
||||||
|
|
||||||
|
private volatile MavenSession session;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
latch.await();
|
||||||
|
}
|
||||||
|
catch (InterruptedException ingore)
|
||||||
|
{
|
||||||
|
// Test may fail if we get interrupted
|
||||||
|
}
|
||||||
|
session = defaultLegacySupport.getSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MavenSession getSession() {
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -74,6 +74,16 @@
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
<!-- CLI -->
|
<!-- CLI -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-cli</groupId>
|
<groupId>commons-cli</groupId>
|
||||||
|
|
|
@ -97,6 +97,8 @@ public class CLIManager
|
||||||
|
|
||||||
public static final String THREADS = "T";
|
public static final String THREADS = "T";
|
||||||
|
|
||||||
|
public static final String LEGACY_LOCAL_REPOSITORY ="llr";
|
||||||
|
|
||||||
protected Options options;
|
protected Options options;
|
||||||
|
|
||||||
@SuppressWarnings( "static-access" )
|
@SuppressWarnings( "static-access" )
|
||||||
|
@ -133,9 +135,9 @@ public class CLIManager
|
||||||
options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) );
|
options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) );
|
||||||
options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) );
|
options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) );
|
||||||
options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
|
options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
|
||||||
|
options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) );
|
||||||
|
|
||||||
// Adding this back in for compatibility with the verifier that hard codes this option.
|
// Adding this back in for compatibility with the verifier that hard codes this option.
|
||||||
|
|
||||||
options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );
|
options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );
|
||||||
options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "cpu" ) );
|
options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "cpu" ) );
|
||||||
options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "up" ) );
|
options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "up" ) );
|
||||||
|
|
|
@ -53,11 +53,15 @@ public final class CLIReportingUtils
|
||||||
Properties properties = getBuildProperties();
|
Properties properties = getBuildProperties();
|
||||||
StringBuffer version = new StringBuffer();
|
StringBuffer version = new StringBuffer();
|
||||||
version.append( createMavenVersionString( properties ) ).append( LS );
|
version.append( createMavenVersionString( properties ) ).append( LS );
|
||||||
version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " + System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( LS );
|
version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: "
|
||||||
version.append( "Java version: " + System.getProperty( "java.version", "<unknown java version>" ) + ", vendor: " + System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS );
|
+ System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( LS );
|
||||||
|
version.append( "Java version: " + System.getProperty( "java.version", "<unknown java version>" )
|
||||||
|
+ ", vendor: " + System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS );
|
||||||
version.append( "Java home: " + System.getProperty( "java.home", "<unknown java home>" ) ).append( LS );
|
version.append( "Java home: " + System.getProperty( "java.home", "<unknown java home>" ) ).append( LS );
|
||||||
version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: " + System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( LS );
|
version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: "
|
||||||
version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH + "\", family: \"" + Os.OS_FAMILY + "\"" );
|
+ System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( LS );
|
||||||
|
version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH
|
||||||
|
+ "\", family: \"" + Os.OS_FAMILY + "\"" );
|
||||||
return version.toString();
|
return version.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +83,7 @@ public final class CLIReportingUtils
|
||||||
if ( rev != null || timestamp != null )
|
if ( rev != null || timestamp != null )
|
||||||
{
|
{
|
||||||
msg += " (";
|
msg += " (";
|
||||||
msg += ( rev != null ? "r" + rev : "" );
|
msg += ( rev != null ? rev : "" );
|
||||||
if ( timestamp != null )
|
if ( timestamp != null )
|
||||||
{
|
{
|
||||||
SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" );
|
SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" );
|
||||||
|
|
|
@ -39,7 +39,10 @@ import org.apache.maven.InternalErrorException;
|
||||||
import org.apache.maven.Maven;
|
import org.apache.maven.Maven;
|
||||||
import org.apache.maven.cli.event.DefaultEventSpyContext;
|
import org.apache.maven.cli.event.DefaultEventSpyContext;
|
||||||
import org.apache.maven.cli.event.ExecutionEventLogger;
|
import org.apache.maven.cli.event.ExecutionEventLogger;
|
||||||
|
import org.apache.maven.cli.logging.Slf4jConfiguration;
|
||||||
|
import org.apache.maven.cli.logging.Slf4jConfigurationFactory;
|
||||||
import org.apache.maven.cli.logging.Slf4jLoggerManager;
|
import org.apache.maven.cli.logging.Slf4jLoggerManager;
|
||||||
|
import org.apache.maven.cli.logging.Slf4jStdoutLogger;
|
||||||
import org.apache.maven.cli.transfer.ConsoleMavenTransferListener;
|
import org.apache.maven.cli.transfer.ConsoleMavenTransferListener;
|
||||||
import org.apache.maven.cli.transfer.QuietMavenTransferListener;
|
import org.apache.maven.cli.transfer.QuietMavenTransferListener;
|
||||||
import org.apache.maven.cli.transfer.Slf4jMavenTransferListener;
|
import org.apache.maven.cli.transfer.Slf4jMavenTransferListener;
|
||||||
|
@ -55,7 +58,6 @@ import org.apache.maven.execution.MavenExecutionResult;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder;
|
import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder;
|
||||||
import org.apache.maven.model.building.ModelProcessor;
|
import org.apache.maven.model.building.ModelProcessor;
|
||||||
import org.apache.maven.plugin.PluginRealmCache;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.properties.internal.EnvironmentUtils;
|
import org.apache.maven.properties.internal.EnvironmentUtils;
|
||||||
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
|
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
|
||||||
|
@ -208,6 +210,7 @@ public class MavenCli
|
||||||
settings( cliRequest );
|
settings( cliRequest );
|
||||||
populateRequest( cliRequest );
|
populateRequest( cliRequest );
|
||||||
encryption( cliRequest );
|
encryption( cliRequest );
|
||||||
|
repository( cliRequest );
|
||||||
return execute( cliRequest );
|
return execute( cliRequest );
|
||||||
}
|
}
|
||||||
catch ( ExitException e )
|
catch ( ExitException e )
|
||||||
|
@ -233,7 +236,7 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (localContainer != null)
|
if ( localContainer != null )
|
||||||
{
|
{
|
||||||
localContainer.dispose();
|
localContainer.dispose();
|
||||||
}
|
}
|
||||||
|
@ -262,6 +265,12 @@ public class MavenCli
|
||||||
private void cli( CliRequest cliRequest )
|
private void cli( CliRequest cliRequest )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Parsing errors can happen during the processing of the arguments and we prefer not having to check if the logger is null
|
||||||
|
// and construct this so we can use an SLF4J logger everywhere.
|
||||||
|
//
|
||||||
|
slf4jLogger = new Slf4jStdoutLogger();
|
||||||
|
|
||||||
CLIManager cliManager = new CLIManager();
|
CLIManager cliManager = new CLIManager();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -288,36 +297,40 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
// All logging is handled by SFL4J
|
* configure logging
|
||||||
//
|
*/
|
||||||
private void logging( CliRequest cliRequest )
|
private void logging( CliRequest cliRequest )
|
||||||
{
|
{
|
||||||
cliRequest.debug = cliRequest.commandLine.hasOption( CLIManager.DEBUG );
|
cliRequest.debug = cliRequest.commandLine.hasOption( CLIManager.DEBUG );
|
||||||
cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption( CLIManager.QUIET );
|
cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption( CLIManager.QUIET );
|
||||||
cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.ERRORS );
|
cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.ERRORS );
|
||||||
|
|
||||||
|
slf4jLoggerFactory = LoggerFactory.getILoggerFactory();
|
||||||
|
Slf4jConfiguration slf4jConfiguration = Slf4jConfigurationFactory.getConfiguration( slf4jLoggerFactory );
|
||||||
|
|
||||||
if ( cliRequest.debug )
|
if ( cliRequest.debug )
|
||||||
{
|
{
|
||||||
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG );
|
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG );
|
||||||
System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "debug" );
|
slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.DEBUG );
|
||||||
}
|
}
|
||||||
else if ( cliRequest.quiet )
|
else if ( cliRequest.quiet )
|
||||||
{
|
{
|
||||||
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR );
|
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR );
|
||||||
System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "error" );
|
slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.ERROR );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO );
|
cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO );
|
||||||
System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "info" );
|
slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.INFO );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
|
if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
|
||||||
{
|
{
|
||||||
File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) );
|
File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) );
|
||||||
logFile = resolveFile( logFile, cliRequest.workingDirectory );
|
logFile = resolveFile( logFile, cliRequest.workingDirectory );
|
||||||
System.setProperty( "org.slf4j.simpleLogger.logFile", logFile.getAbsolutePath() );
|
|
||||||
|
// redirect stdout and stderr to file
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PrintStream ps = new PrintStream( new FileOutputStream( logFile ) );
|
PrintStream ps = new PrintStream( new FileOutputStream( logFile ) );
|
||||||
|
@ -332,8 +345,9 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slf4jConfiguration.activate();
|
||||||
|
|
||||||
plexusLoggerManager = new Slf4jLoggerManager();
|
plexusLoggerManager = new Slf4jLoggerManager();
|
||||||
slf4jLoggerFactory = LoggerFactory.getILoggerFactory();
|
|
||||||
slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() );
|
slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,29 +391,27 @@ public class MavenCli
|
||||||
|
|
||||||
DefaultPlexusContainer container = null;
|
DefaultPlexusContainer container = null;
|
||||||
|
|
||||||
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
||||||
.setClassWorld( cliRequest.classWorld )
|
.setClassWorld( cliRequest.classWorld )
|
||||||
.setRealm( setupContainerRealm( cliRequest ) )
|
.setRealm( setupContainerRealm( cliRequest ) )
|
||||||
.setClassPathScanning( PlexusConstants.SCANNING_INDEX )
|
.setClassPathScanning( PlexusConstants.SCANNING_INDEX )
|
||||||
.setAutoWiring( true )
|
.setAutoWiring( true )
|
||||||
.setName( "maven" );
|
.setName( "maven" );
|
||||||
|
|
||||||
container = new DefaultPlexusContainer( cc, new AbstractModule()
|
container = new DefaultPlexusContainer( cc, new AbstractModule()
|
||||||
|
{
|
||||||
|
protected void configure()
|
||||||
{
|
{
|
||||||
|
bind( ILoggerFactory.class ).toInstance( slf4jLoggerFactory );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
protected void configure()
|
// NOTE: To avoid inconsistencies, we'll use the TCCL exclusively for lookups
|
||||||
{
|
container.setLookupRealm( null );
|
||||||
bind( ILoggerFactory.class ).toInstance( slf4jLoggerFactory );
|
|
||||||
}
|
|
||||||
|
|
||||||
} );
|
container.setLoggerManager( plexusLoggerManager );
|
||||||
|
|
||||||
// NOTE: To avoid inconsistencies, we'll use the TCCL exclusively for lookups
|
customizeContainer( container );
|
||||||
container.setLookupRealm( null );
|
|
||||||
|
|
||||||
container.setLoggerManager( plexusLoggerManager );
|
|
||||||
|
|
||||||
customizeContainer( container );
|
|
||||||
|
|
||||||
container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
|
container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
|
||||||
|
|
||||||
|
@ -527,6 +539,15 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void repository( CliRequest cliRequest )
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
if ( cliRequest.commandLine.hasOption( CLIManager.LEGACY_LOCAL_REPOSITORY ) || Boolean.getBoolean( "maven.legacyLocalRepo" ) )
|
||||||
|
{
|
||||||
|
cliRequest.request.setUseLegacyLocalRepository( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int execute( CliRequest cliRequest )
|
private int execute( CliRequest cliRequest )
|
||||||
{
|
{
|
||||||
eventSpyDispatcher.onEvent( cliRequest.request );
|
eventSpyDispatcher.onEvent( cliRequest.request );
|
||||||
|
@ -888,7 +909,7 @@ public class MavenCli
|
||||||
transferListener = getBatchTransferListener();
|
transferListener = getBatchTransferListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutionListener executionListener = new ExecutionEventLogger( slf4jLogger );
|
ExecutionListener executionListener = new ExecutionEventLogger();
|
||||||
executionListener = eventSpyDispatcher.chainListener( executionListener );
|
executionListener = eventSpyDispatcher.chainListener( executionListener );
|
||||||
|
|
||||||
String alternatePomFile = null;
|
String alternatePomFile = null;
|
||||||
|
@ -1154,7 +1175,7 @@ public class MavenCli
|
||||||
|
|
||||||
protected TransferListener getBatchTransferListener()
|
protected TransferListener getBatchTransferListener()
|
||||||
{
|
{
|
||||||
return new Slf4jMavenTransferListener( slf4jLogger );
|
return new Slf4jMavenTransferListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void customizeContainer( PlexusContainer container )
|
protected void customizeContainer( PlexusContainer container )
|
||||||
|
|
|
@ -31,9 +31,10 @@ import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs execution events to a user-supplied logger.
|
* Logs execution events to logger, eventually user-supplied.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +45,12 @@ public class ExecutionEventLogger
|
||||||
|
|
||||||
private static final int LINE_LENGTH = 72;
|
private static final int LINE_LENGTH = 72;
|
||||||
|
|
||||||
|
public ExecutionEventLogger()
|
||||||
|
{
|
||||||
|
logger = LoggerFactory.getLogger( ExecutionEventLogger.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO should we deprecate?
|
||||||
public ExecutionEventLogger( Logger logger )
|
public ExecutionEventLogger( Logger logger )
|
||||||
{
|
{
|
||||||
if ( logger == null )
|
if ( logger == null )
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.apache.maven.cli.logging;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract implementation.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public class BaseSlf4jConfiguration
|
||||||
|
implements Slf4jConfiguration
|
||||||
|
{
|
||||||
|
private final Logger logger = LoggerFactory.getLogger( BaseSlf4jConfiguration.class );
|
||||||
|
|
||||||
|
public void setRootLoggerLevel( Level level )
|
||||||
|
{
|
||||||
|
logger.warn( "setRootLoggerLevel: operation not supported" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void activate()
|
||||||
|
{
|
||||||
|
logger.warn( "reset(): operation not supported" );
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,187 +0,0 @@
|
||||||
package org.apache.maven.cli.logging;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 java.io.PrintStream;
|
|
||||||
|
|
||||||
import org.apache.maven.Maven;
|
|
||||||
import org.codehaus.plexus.logging.AbstractLogger;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs to a user-supplied {@link PrintStream}.
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
*/
|
|
||||||
public class PrintStreamLogger
|
|
||||||
extends AbstractLogger
|
|
||||||
{
|
|
||||||
|
|
||||||
public interface Provider
|
|
||||||
{
|
|
||||||
PrintStream getStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Provider provider;
|
|
||||||
|
|
||||||
private static final String FATAL_ERROR = "[FATAL] ";
|
|
||||||
|
|
||||||
private static final String ERROR = "[ERROR] ";
|
|
||||||
|
|
||||||
private static final String WARNING = "[WARNING] ";
|
|
||||||
|
|
||||||
private static final String INFO = "[INFO] ";
|
|
||||||
|
|
||||||
private static final String DEBUG = "[DEBUG] ";
|
|
||||||
|
|
||||||
public PrintStreamLogger( Provider provider )
|
|
||||||
{
|
|
||||||
super( Logger.LEVEL_INFO, Maven.class.getName() );
|
|
||||||
|
|
||||||
if ( provider == null )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "output stream provider missing" );
|
|
||||||
}
|
|
||||||
this.provider = provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrintStreamLogger( PrintStream out )
|
|
||||||
{
|
|
||||||
super( Logger.LEVEL_INFO, Maven.class.getName() );
|
|
||||||
|
|
||||||
setStream( out );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStream( final PrintStream out )
|
|
||||||
{
|
|
||||||
if ( out == null )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "output stream missing" );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.provider = new Provider()
|
|
||||||
{
|
|
||||||
public PrintStream getStream()
|
|
||||||
{
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void debug( String message, Throwable throwable )
|
|
||||||
{
|
|
||||||
if ( isDebugEnabled() )
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
out.print( DEBUG );
|
|
||||||
out.println( message );
|
|
||||||
|
|
||||||
if ( null != throwable )
|
|
||||||
{
|
|
||||||
throwable.printStackTrace( out );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void info( String message, Throwable throwable )
|
|
||||||
{
|
|
||||||
if ( isInfoEnabled() )
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
out.print( INFO );
|
|
||||||
out.println( message );
|
|
||||||
|
|
||||||
if ( null != throwable )
|
|
||||||
{
|
|
||||||
throwable.printStackTrace( out );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void warn( String message, Throwable throwable )
|
|
||||||
{
|
|
||||||
if ( isWarnEnabled() )
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
out.print( WARNING );
|
|
||||||
out.println( message );
|
|
||||||
|
|
||||||
if ( null != throwable )
|
|
||||||
{
|
|
||||||
throwable.printStackTrace( out );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void error( String message, Throwable throwable )
|
|
||||||
{
|
|
||||||
if ( isErrorEnabled() )
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
out.print( ERROR );
|
|
||||||
out.println( message );
|
|
||||||
|
|
||||||
if ( null != throwable )
|
|
||||||
{
|
|
||||||
throwable.printStackTrace( out );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fatalError( String message, Throwable throwable )
|
|
||||||
{
|
|
||||||
if ( isFatalErrorEnabled() )
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
out.print( FATAL_ERROR );
|
|
||||||
out.println( message );
|
|
||||||
|
|
||||||
if ( null != throwable )
|
|
||||||
{
|
|
||||||
throwable.printStackTrace( out );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
PrintStream out = provider.getStream();
|
|
||||||
|
|
||||||
if ( out == System.out || out == System.err )
|
|
||||||
{
|
|
||||||
out.flush();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Logger getChildLogger( String arg0 )
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.maven.cli.logging;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for configuration operations on loggers, which are not available in slf4j, then require per-slf4f-binding
|
||||||
|
* implementation.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public interface Slf4jConfiguration
|
||||||
|
{
|
||||||
|
public static enum Level { DEBUG, INFO, ERROR }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set root logging level.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
*/
|
||||||
|
void setRootLoggerLevel( Level level );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate logging implementation configuration (if necessary).
|
||||||
|
*/
|
||||||
|
void activate();
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package org.apache.maven.cli.logging;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.codehaus.plexus.util.PropertyUtils;
|
||||||
|
import org.slf4j.ILoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Slf4jConfiguration factory, loading implementations from <code>META-INF/maven/slf4j-configuration.properties</code>
|
||||||
|
* configuration files in class loader.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public class Slf4jConfigurationFactory
|
||||||
|
{
|
||||||
|
public static final String RESOURCE = "META-INF/maven/slf4j-configuration.properties";
|
||||||
|
|
||||||
|
public static Slf4jConfiguration getConfiguration( ILoggerFactory loggerFactory )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Enumeration<URL> resources = Slf4jConfigurationFactory.class.getClassLoader().getResources( RESOURCE );
|
||||||
|
|
||||||
|
String key = loggerFactory.getClass().getCanonicalName();
|
||||||
|
|
||||||
|
while ( resources.hasMoreElements() )
|
||||||
|
{
|
||||||
|
URL resource = resources.nextElement();
|
||||||
|
|
||||||
|
Properties conf = PropertyUtils.loadProperties( resource.openStream() );
|
||||||
|
|
||||||
|
String impl = conf.getProperty( key );
|
||||||
|
|
||||||
|
if ( impl != null )
|
||||||
|
{
|
||||||
|
return (Slf4jConfiguration) Class.forName( impl ).newInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch ( InstantiationException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch ( IllegalAccessException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch ( ClassNotFoundException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseSlf4jConfiguration();
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,7 +114,7 @@ public class Slf4jLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Warning</b>: ignored (always return <code>0</code>).
|
* <b>Warning</b>: ignored (always return <code>0 == Logger.LEVEL_DEBUG</code>).
|
||||||
*/
|
*/
|
||||||
public int getThreshold()
|
public int getThreshold()
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ public class Slf4jLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Warning</b>: ignored (always return <code>0</code>).
|
* <b>Warning</b>: ignored (always return <code>null</code>).
|
||||||
*/
|
*/
|
||||||
public Logger getChildLogger( String name )
|
public Logger getChildLogger( String name )
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,303 @@
|
||||||
|
package org.apache.maven.cli.logging;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 java.io.PrintStream;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.Marker;
|
||||||
|
|
||||||
|
public class Slf4jStdoutLogger
|
||||||
|
implements Logger
|
||||||
|
{
|
||||||
|
private static final String ERROR = "[ERROR] ";
|
||||||
|
|
||||||
|
private PrintStream out = System.out;
|
||||||
|
|
||||||
|
//
|
||||||
|
// These are the only methods we need in our primordial logger
|
||||||
|
//
|
||||||
|
public void error( String msg )
|
||||||
|
{
|
||||||
|
out.print( ERROR );
|
||||||
|
out.println( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( String msg, Throwable t )
|
||||||
|
{
|
||||||
|
error( msg );
|
||||||
|
|
||||||
|
if ( null != t )
|
||||||
|
{
|
||||||
|
t.printStackTrace( out );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Don't need any of this
|
||||||
|
//
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTraceEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTraceEnabled( Marker marker )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( Marker marker, String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( Marker marker, String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( Marker marker, String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( Marker marker, String format, Object... argArray )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace( Marker marker, String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDebugEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDebugEnabled( Marker marker )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( Marker marker, String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( Marker marker, String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( Marker marker, String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( Marker marker, String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( Marker marker, String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInfoEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInfoEnabled( Marker marker )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( Marker marker, String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( Marker marker, String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( Marker marker, String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( Marker marker, String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info( Marker marker, String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWarnEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWarnEnabled( Marker marker )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( Marker marker, String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( Marker marker, String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( Marker marker, String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( Marker marker, String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn( Marker marker, String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isErrorEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isErrorEnabled( Marker marker )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( Marker marker, String msg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( Marker marker, String format, Object arg )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( Marker marker, String format, Object arg1, Object arg2 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( Marker marker, String format, Object... arguments )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error( Marker marker, String msg, Throwable t )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.apache.maven.cli.logging.impl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.maven.cli.logging.BaseSlf4jConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for slf4j-log4j2.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public class Log4j2Configuration
|
||||||
|
extends BaseSlf4jConfiguration
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void setRootLoggerLevel( Level level )
|
||||||
|
{
|
||||||
|
String value = "info";
|
||||||
|
switch ( level )
|
||||||
|
{
|
||||||
|
case DEBUG:
|
||||||
|
value = "debug";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INFO:
|
||||||
|
value = "info";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ERROR:
|
||||||
|
value = "error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.setProperty( "maven.logging.root.level", value );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activate()
|
||||||
|
{
|
||||||
|
// no op
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.apache.maven.cli.logging.impl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.maven.cli.logging.BaseSlf4jConfiguration;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for slf4j-logback.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public class LogbackConfiguration
|
||||||
|
extends BaseSlf4jConfiguration
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void setRootLoggerLevel( Level level )
|
||||||
|
{
|
||||||
|
ch.qos.logback.classic.Level value = ch.qos.logback.classic.Level.INFO;
|
||||||
|
switch ( level )
|
||||||
|
{
|
||||||
|
case DEBUG:
|
||||||
|
value = ch.qos.logback.classic.Level.DEBUG;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INFO:
|
||||||
|
value = ch.qos.logback.classic.Level.INFO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ERROR:
|
||||||
|
value = ch.qos.logback.classic.Level.ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activate()
|
||||||
|
{
|
||||||
|
// no op
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package org.apache.maven.cli.logging.impl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.maven.cli.logging.BaseSlf4jConfiguration;
|
||||||
|
import org.slf4j.MavenSlf4jFriend;
|
||||||
|
import org.slf4j.impl.MavenSlf4jSimpleFriend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for slf4j-simple.
|
||||||
|
*
|
||||||
|
* @author Hervé Boutemy
|
||||||
|
*/
|
||||||
|
public class Slf4jSimpleConfiguration
|
||||||
|
extends BaseSlf4jConfiguration
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void setRootLoggerLevel( Level level )
|
||||||
|
{
|
||||||
|
String value = "info";
|
||||||
|
switch ( level )
|
||||||
|
{
|
||||||
|
case DEBUG:
|
||||||
|
value = "debug";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INFO:
|
||||||
|
value = "info";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ERROR:
|
||||||
|
value = "error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", value );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activate()
|
||||||
|
{
|
||||||
|
// property for root logger level or System.out redirection need to be taken into account
|
||||||
|
MavenSlf4jFriend.reset();
|
||||||
|
MavenSlf4jSimpleFriend.init();
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sonatype.aether.transfer.AbstractTransferListener;
|
import org.sonatype.aether.transfer.AbstractTransferListener;
|
||||||
import org.sonatype.aether.transfer.TransferCancelledException;
|
import org.sonatype.aether.transfer.TransferCancelledException;
|
||||||
import org.sonatype.aether.transfer.TransferEvent;
|
import org.sonatype.aether.transfer.TransferEvent;
|
||||||
|
@ -33,8 +34,14 @@ public class Slf4jMavenTransferListener
|
||||||
extends AbstractTransferListener
|
extends AbstractTransferListener
|
||||||
{
|
{
|
||||||
|
|
||||||
protected Logger out;
|
protected final Logger out;
|
||||||
|
|
||||||
|
public Slf4jMavenTransferListener()
|
||||||
|
{
|
||||||
|
this.out = LoggerFactory.getLogger( Slf4jMavenTransferListener.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO should we deprecate?
|
||||||
public Slf4jMavenTransferListener( Logger out )
|
public Slf4jMavenTransferListener( Logger out )
|
||||||
{
|
{
|
||||||
this.out = out;
|
this.out = out;
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.slf4j;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility for Maven to access Slf4j internals through package access.
|
||||||
|
* Use with precaution, since this is not normally intended for production use.
|
||||||
|
*/
|
||||||
|
public class MavenSlf4jFriend
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Reset Slf4j internal state.
|
||||||
|
*/
|
||||||
|
public static void reset()
|
||||||
|
{
|
||||||
|
LoggerFactory.reset();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.slf4j.impl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility for Maven to access Slf4j-Simple internals through package access.
|
||||||
|
* Use with precaution, since this is not normally intended for production use.
|
||||||
|
*/
|
||||||
|
public class MavenSlf4jSimpleFriend
|
||||||
|
{
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
SimpleLogger.init();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
# key = Slf4j effective logger factory implementation
|
||||||
|
# value = corresponding o.a.m.cli.logging.Slf4jConfiguration class
|
||||||
|
org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration
|
||||||
|
org.slf4j.helpers.Log4JLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration
|
||||||
|
ch.qos.logback.classic.LoggerContext org.apache.maven.cli.logging.impl.LogbackConfiguration
|
|
@ -22,7 +22,7 @@ Maven Logging
|
||||||
|
|
||||||
* Getting Logger Instance
|
* Getting Logger Instance
|
||||||
|
|
||||||
Plexus Logger can be injected in Plexus component using Plexus annotations
|
Plexus Logger and LoggerManager can be injected in Plexus component using Plexus annotations
|
||||||
|
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
+------
|
+------
|
||||||
|
@ -39,6 +39,9 @@ public class DefaultMyComponent
|
||||||
{
|
{
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private LoggerManager loggerManager;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
+------
|
+------
|
||||||
|
|
|
@ -278,6 +278,8 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
modelNormalizer.mergeDuplicates( tmpModel, request, problems );
|
modelNormalizer.mergeDuplicates( tmpModel, request, problems );
|
||||||
|
|
||||||
|
profileActivationContext.setProjectProperties( tmpModel.getProperties() );
|
||||||
|
|
||||||
List<Profile> activePomProfiles =
|
List<Profile> activePomProfiles =
|
||||||
profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems );
|
profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems );
|
||||||
currentData.setActiveProfiles( activePomProfiles );
|
currentData.setActiveProfiles( activePomProfiles );
|
||||||
|
@ -317,7 +319,7 @@ public class DefaultModelBuilder
|
||||||
}
|
}
|
||||||
message += currentData.getId();
|
message += currentData.getId();
|
||||||
|
|
||||||
problems.add( new ModelProblemCollectorRequest(ModelProblem.Severity.FATAL, ModelProblem.Version.BASE).setMessage(message));
|
problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL, ModelProblem.Version.BASE ).setMessage( message ) );
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,7 +411,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
modelValidator.validateEffectiveModel( resultModel, request, problems );
|
modelValidator.validateEffectiveModel( resultModel, request, problems );
|
||||||
|
|
||||||
if ( hasModelErrors(problems) )
|
if ( hasModelErrors( problems ) )
|
||||||
{
|
{
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
|
@ -471,15 +473,15 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
if ( pomFile != null )
|
if ( pomFile != null )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.V20)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 )
|
||||||
.setMessage("Malformed POM " + modelSource.getLocation() + ": " + e.getMessage())
|
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
|
||||||
.setException(e ));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.WARNING, Version.V20)
|
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
|
||||||
.setMessage("Malformed POM " + modelSource.getLocation() + ": " + e.getMessage())
|
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
|
||||||
.setException(e));
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,9 +493,9 @@ public class DefaultModelBuilder
|
||||||
}
|
}
|
||||||
catch ( ModelParseException e )
|
catch ( ModelParseException e )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
|
||||||
.setMessage("Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage())
|
.setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() )
|
||||||
.setException(e));
|
.setException( e ) );
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
|
@ -511,9 +513,9 @@ public class DefaultModelBuilder
|
||||||
msg = e.getClass().getSimpleName();
|
msg = e.getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
|
||||||
.setMessage("Non-readable POM " + modelSource.getLocation() + ": " + msg)
|
.setMessage( "Non-readable POM " + modelSource.getLocation() + ": " + msg )
|
||||||
.setException(e ));
|
.setException( e ) );
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +524,7 @@ public class DefaultModelBuilder
|
||||||
problems.setSource( model );
|
problems.setSource( model );
|
||||||
modelValidator.validateRawModel( model, request, problems );
|
modelValidator.validateRawModel( model, request, problems );
|
||||||
|
|
||||||
if ( hasFatalErrors(problems) )
|
if ( hasFatalErrors( problems ) )
|
||||||
{
|
{
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
|
@ -562,10 +564,10 @@ public class DefaultModelBuilder
|
||||||
}
|
}
|
||||||
catch ( InvalidRepositoryException e )
|
catch ( InvalidRepositoryException e )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage())
|
.setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() )
|
||||||
.setLocation(repository.getLocation( "" ))
|
.setLocation( repository.getLocation( "" ) )
|
||||||
.setException(e) );
|
.setException( e ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,9 +619,9 @@ public class DefaultModelBuilder
|
||||||
if ( versions.get( key ) == null && managedVersions.get( key ) == null )
|
if ( versions.get( key ) == null && managedVersions.get( key ) == null )
|
||||||
{
|
{
|
||||||
InputLocation location = plugins.get( key ).getLocation( "" );
|
InputLocation location = plugins.get( key ).getLocation( "" );
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.WARNING, Version.V20)
|
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
|
||||||
.setMessage( "'build.plugins.plugin.version' for " + key + " is missing.")
|
.setMessage( "'build.plugins.plugin.version' for " + key + " is missing." )
|
||||||
.setLocation(location));
|
.setLocation( location ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -694,10 +696,10 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
if ( !"pom".equals( parentModel.getPackaging() ) )
|
if ( !"pom".equals( parentModel.getPackaging() ) )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel ) + ", must be \"pom\" but is \""
|
.setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel )
|
||||||
+ parentModel.getPackaging() + "\"")
|
+ ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" )
|
||||||
.setLocation(parentModel.getLocation( "packaging" )));
|
.setLocation( parentModel.getLocation( "packaging" ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -749,9 +751,9 @@ public class DefaultModelBuilder
|
||||||
buffer.append( ", please verify your project structure" );
|
buffer.append( ", please verify your project structure" );
|
||||||
|
|
||||||
problems.setSource( childModel );
|
problems.setSource( childModel );
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE )
|
||||||
.setMessage( buffer.toString())
|
.setMessage( buffer.toString() )
|
||||||
.setLocation( parent.getLocation( "" )));
|
.setLocation( parent.getLocation( "" ) ) );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ( version == null || !version.equals( parent.getVersion() ) )
|
if ( version == null || !version.equals( parent.getVersion() ) )
|
||||||
|
@ -843,10 +845,10 @@ public class DefaultModelBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
|
||||||
.setMessage( buffer.toString())
|
.setMessage( buffer.toString() )
|
||||||
.setLocation(parent.getLocation( "" ))
|
.setLocation( parent.getLocation( "" ) )
|
||||||
.setException(e));
|
.setException( e ) );
|
||||||
throw problems.newModelBuildingException();
|
throw problems.newModelBuildingException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,23 +914,26 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
if ( groupId == null || groupId.length() <= 0 )
|
if ( groupId == null || groupId.length() <= 0 )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "'dependencyManagement.dependencies.dependency.groupId' for " + dependency.getManagementKey() + " is missing.")
|
.setMessage( "'dependencyManagement.dependencies.dependency.groupId' for "
|
||||||
.setLocation( dependency.getLocation( "" )));
|
+ dependency.getManagementKey() + " is missing." )
|
||||||
|
.setLocation( dependency.getLocation( "" ) ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( artifactId == null || artifactId.length() <= 0 )
|
if ( artifactId == null || artifactId.length() <= 0 )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for " + dependency.getManagementKey() + " is missing.")
|
.setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for "
|
||||||
.setLocation( dependency.getLocation( "" )));
|
+ dependency.getManagementKey() + " is missing." )
|
||||||
|
.setLocation( dependency.getLocation( "" ) ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( version == null || version.length() <= 0 )
|
if ( version == null || version.length() <= 0 )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( "'dependencyManagement.dependencies.dependency.version' for " + dependency.getManagementKey() + " is missing.")
|
.setMessage( "'dependencyManagement.dependencies.dependency.version' for "
|
||||||
.setLocation( dependency.getLocation( "" )));
|
+ dependency.getManagementKey() + " is missing." )
|
||||||
|
.setLocation( dependency.getLocation( "" ) ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,7 +947,7 @@ public class DefaultModelBuilder
|
||||||
message += modelId + " -> ";
|
message += modelId + " -> ";
|
||||||
}
|
}
|
||||||
message += imported;
|
message += imported;
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message ));
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message ) );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -976,8 +981,8 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
.setMessage( buffer.toString() )
|
.setMessage( buffer.toString() )
|
||||||
.setLocation( dependency.getLocation( "" ))
|
.setLocation( dependency.getLocation( "" ) )
|
||||||
.setException( e ));
|
.setException( e ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,24 +1081,31 @@ public class DefaultModelBuilder
|
||||||
&& ( version == null || message.contains( version ) );
|
&& ( version == null || message.contains( version ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasModelErrors(ModelProblemCollectorExt problems) {
|
protected boolean hasModelErrors( ModelProblemCollectorExt problems )
|
||||||
if (problems instanceof DefaultModelProblemCollector) {
|
{
|
||||||
return ((DefaultModelProblemCollector)problems).hasErrors();
|
if ( problems instanceof DefaultModelProblemCollector )
|
||||||
} else {
|
{
|
||||||
//the default execution path only knows the DefaultModelProblemCollector,
|
return ( (DefaultModelProblemCollector) problems ).hasErrors();
|
||||||
// only reason it's not in signature is because it's package private
|
}
|
||||||
throw new IllegalStateException();
|
else
|
||||||
|
{
|
||||||
|
// the default execution path only knows the DefaultModelProblemCollector,
|
||||||
|
// only reason it's not in signature is because it's package private
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasFatalErrors(ModelProblemCollectorExt problems) {
|
protected boolean hasFatalErrors( ModelProblemCollectorExt problems )
|
||||||
if (problems instanceof DefaultModelProblemCollector) {
|
{
|
||||||
return ((DefaultModelProblemCollector)problems).hasFatalErrors();
|
if ( problems instanceof DefaultModelProblemCollector )
|
||||||
} else {
|
{
|
||||||
//the default execution path only knows the DefaultModelProblemCollector,
|
return ( (DefaultModelProblemCollector) problems ).hasFatalErrors();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the default execution path only knows the DefaultModelProblemCollector,
|
||||||
// only reason it's not in signature is because it's package private
|
// only reason it's not in signature is because it's package private
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,8 @@ public class DefaultModelProblem
|
||||||
return severity;
|
return severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Version getVersion() {
|
public Version getVersion()
|
||||||
|
{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,7 @@ import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.maven.model.InputLocation;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
|
||||||
import org.apache.maven.model.io.ModelParseException;
|
import org.apache.maven.model.io.ModelParseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +171,9 @@ class DefaultModelProblemCollector
|
||||||
column = e.getColumnNumber();
|
column = e.getColumnNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelProblem problem = new DefaultModelProblem( req.getMessage(), req.getSeverity(), req.getVersion(), source, line, column, modelId, req.getException() );
|
ModelProblem problem =
|
||||||
|
new DefaultModelProblem( req.getMessage(), req.getSeverity(), req.getVersion(), source, line, column,
|
||||||
|
modelId, req.getException() );
|
||||||
|
|
||||||
add( problem );
|
add( problem );
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public interface ModelProblem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Version {
|
enum Version
|
||||||
|
{
|
||||||
//based on ModeBuildingResult.validationLevel
|
//based on ModeBuildingResult.validationLevel
|
||||||
BASE,
|
BASE,
|
||||||
V20,
|
V20,
|
||||||
|
|
|
@ -19,9 +19,6 @@ package org.apache.maven.model.building;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.maven.model.InputLocation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects problems that are encountered during model building. The primary purpose of this component is to account for
|
* Collects problems that are encountered during model building. The primary purpose of this component is to account for
|
||||||
* the fact that the problem reporter has/should not have information about the calling context and hence cannot provide
|
* the fact that the problem reporter has/should not have information about the calling context and hence cannot provide
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
/*
|
|
||||||
* Copyright 2012 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* Licensed 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.model.building;
|
package org.apache.maven.model.building;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.maven.model.InputLocation;
|
import org.apache.maven.model.InputLocation;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
import org.apache.maven.model.building.ModelProblem.Severity;
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
|
@ -38,17 +42,17 @@ public final class ModelProblemCollectorRequest
|
||||||
* @param severity
|
* @param severity
|
||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
public ModelProblemCollectorRequest(Severity severity, Version version)
|
public ModelProblemCollectorRequest( Severity severity, Version version )
|
||||||
{
|
{
|
||||||
this.severity = severity;
|
this.severity = severity;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
if (severity == null)
|
if ( severity == null )
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No severity declared");
|
throw new IllegalStateException( "No severity declared" );
|
||||||
}
|
}
|
||||||
if (version == null)
|
if ( version == null )
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No version declared.");
|
throw new IllegalStateException( "No version declared." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +71,7 @@ public final class ModelProblemCollectorRequest
|
||||||
return exception;
|
return exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelProblemCollectorRequest setException(Exception exception)
|
public ModelProblemCollectorRequest setException( Exception exception )
|
||||||
{
|
{
|
||||||
this.exception = exception;
|
this.exception = exception;
|
||||||
return this;
|
return this;
|
||||||
|
@ -78,7 +82,7 @@ public final class ModelProblemCollectorRequest
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelProblemCollectorRequest setMessage(String message)
|
public ModelProblemCollectorRequest setMessage( String message )
|
||||||
{
|
{
|
||||||
this.message = message;
|
this.message = message;
|
||||||
return this;
|
return this;
|
||||||
|
@ -89,7 +93,7 @@ public final class ModelProblemCollectorRequest
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelProblemCollectorRequest setLocation(InputLocation location)
|
public ModelProblemCollectorRequest setLocation( InputLocation location )
|
||||||
{
|
{
|
||||||
this.location = location;
|
this.location = location;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -58,12 +58,17 @@ public class DefaultInheritanceAssembler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the relative path from the base directory of the parent to the parent directory of the base directory
|
* Calculates the relative path from the base directory of the parent to the parent directory of the base directory
|
||||||
* of the child. The general idea is to adjust inherited URLs to match the project layout (in SCM). This calculation
|
* of the child. The general idea is to adjust inherited URLs to match the project layout (in SCM).
|
||||||
* is only a heuristic based on our conventions. In detail, the algo relies on the following assumptions. The parent
|
*
|
||||||
* uses aggregation and refers to the child via the modules section. The module path to the child is considered to
|
* <p>This calculation is only a heuristic based on our conventions.
|
||||||
* point at the POM rather than its base directory if the path ends with ".xml" (ignoring case). The name of the
|
* In detail, the algo relies on the following assumptions: <ul>
|
||||||
* child's base directory matches the artifact id of the child. Note that for the sake of independence from the user
|
* <li>The parent uses aggregation and refers to the child via the modules section</li>
|
||||||
* environment, the filesystem is intentionally not used for the calculation.
|
* <li>The module path to the child is considered to
|
||||||
|
* point at the POM rather than its base directory if the path ends with ".xml" (ignoring case)</li>
|
||||||
|
* <li>The name of the child's base directory matches the artifact id of the child.</li>
|
||||||
|
* </ul>
|
||||||
|
* Note that for the sake of independence from the user
|
||||||
|
* environment, the filesystem is intentionally not used for the calculation.</p>
|
||||||
*
|
*
|
||||||
* @param child The child model, must not be <code>null</code>.
|
* @param child The child model, must not be <code>null</code>.
|
||||||
* @param parent The parent model, may be <code>null</code>.
|
* @param parent The parent model, may be <code>null</code>.
|
||||||
|
@ -119,7 +124,7 @@ public class DefaultInheritanceAssembler
|
||||||
return adjustment;
|
return adjustment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class InheritanceModelMerger
|
protected static class InheritanceModelMerger
|
||||||
extends MavenModelMerger
|
extends MavenModelMerger
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import org.apache.maven.model.building.ModelProblem;
|
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
|
|
||||||
|
@ -244,7 +243,8 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
}
|
}
|
||||||
catch ( InterpolationException e )
|
catch ( InterpolationException e )
|
||||||
{
|
{
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( e.getMessage() ).setException( e ));
|
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
|
||||||
|
.setMessage( e.getMessage() ).setException( e ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolator.clearFeedback();
|
interpolator.clearFeedback();
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.maven.model.interpolation;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.maven.model.building.ModelProblem;
|
|
||||||
|
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
import org.apache.maven.model.building.ModelProblem.Severity;
|
||||||
|
@ -65,7 +64,7 @@ class ProblemDetectingValueSource
|
||||||
{
|
{
|
||||||
msg += " Please use ${" + newPrefix + expression.substring( bannedPrefix.length() ) + "} instead.";
|
msg += " Please use ${" + newPrefix + expression.substring( bannedPrefix.length() ) + "} instead.";
|
||||||
}
|
}
|
||||||
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg ));
|
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class StringSearchModelInterpolator
|
||||||
extends AbstractStringBasedModelInterpolator
|
extends AbstractStringBasedModelInterpolator
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Map<Class<?>, InterpolateObjectAction.CacheItem> cachedEntries =
|
private static final Map<Class<?>, InterpolateObjectAction.CacheItem> CACHED_ENTRIES =
|
||||||
new ConcurrentHashMap<Class<?>, InterpolateObjectAction.CacheItem>( 80, 0.75f, 2 );
|
new ConcurrentHashMap<Class<?>, InterpolateObjectAction.CacheItem>( 80, 0.75f, 2 );
|
||||||
// Empirical data from 3.x, actual =40
|
// Empirical data from 3.x, actual =40
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ public class StringSearchModelInterpolator
|
||||||
|
|
||||||
private CacheItem getCacheEntry( Class<?> cls )
|
private CacheItem getCacheEntry( Class<?> cls )
|
||||||
{
|
{
|
||||||
CacheItem cacheItem = cachedEntries.get( cls );
|
CacheItem cacheItem = CACHED_ENTRIES.get( cls );
|
||||||
if ( cacheItem == null )
|
if ( cacheItem == null )
|
||||||
{
|
{
|
||||||
cacheItem = new CacheItem( cls );
|
cacheItem = new CacheItem( cls );
|
||||||
cachedEntries.put( cls, cacheItem );
|
CACHED_ENTRIES.put( cls, cacheItem );
|
||||||
}
|
}
|
||||||
return cacheItem;
|
return cacheItem;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ public class StringSearchModelInterpolator
|
||||||
}
|
}
|
||||||
else if ( Collection.class.isAssignableFrom( type ) )
|
else if ( Collection.class.isAssignableFrom( type ) )
|
||||||
{
|
{
|
||||||
throw new RuntimeException("We dont interpolate into collections, use a list instead");
|
throw new RuntimeException( "We dont interpolate into collections, use a list instead" );
|
||||||
}
|
}
|
||||||
else if ( Map.class.isAssignableFrom( type ) )
|
else if ( Map.class.isAssignableFrom( type ) )
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ public class StringSearchModelInterpolator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static abstract class CacheField
|
abstract static class CacheField
|
||||||
{
|
{
|
||||||
protected final Field field;
|
protected final Field field;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue