mirror of https://github.com/apache/maven.git
Merge branch 'trunk' of github.com:apache/maven-3 into trunk
Conflicts: apache-maven/src/bin/mvn maven-embedder/src/site/apt/logging.apt
This commit is contained in:
commit
38d132b64d
|
@ -53,16 +53,31 @@ mingw=false
|
|||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
<<<<<<< HEAD
|
||||
Darwin*) darwin=true
|
||||
|
||||
=======
|
||||
Darwin*) darwin=true
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
#
|
||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||
# for the new JDKs provided by Oracle.
|
||||
#
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
||||
fi
|
||||
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
<<<<<<< HEAD
|
||||
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
|
||||
|
@ -71,6 +86,16 @@ case "`uname`" in
|
|||
# Oracle JDKs
|
||||
#
|
||||
JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
=======
|
||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
|
||||
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
|
||||
#
|
||||
# Oracle JDKs
|
||||
#
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -58,12 +58,30 @@ case "`uname`" in
|
|||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
if [ -z "$JAVA_VERSION" ] ; then
|
||||
JAVA_VERSION="CurrentJDK"
|
||||
#
|
||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||
# for the new JDKs provided by Oracle.
|
||||
#
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
||||
fi
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
|
||||
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
|
||||
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
|
||||
#
|
||||
# Oracle JDKs
|
||||
#
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -61,17 +61,31 @@ mingw=false
|
|||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
if [ -z "$JAVA_VERSION" ] ; then
|
||||
JAVA_VERSION="CurrentJDK"
|
||||
Darwin*) darwin=true
|
||||
#
|
||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||
# for the new JDKs provided by Oracle.
|
||||
#
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
||||
fi
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
|
||||
|
||||
if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
|
||||
#
|
||||
# Apple JDKs
|
||||
#
|
||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
if [ -z "$YJP_HOME" ]; then
|
||||
YJP_HOME=/Applications/YourKit.app
|
||||
fi
|
||||
YJPLIB=$YJP_HOME/bin/mac/libyjpagent.jnilib
|
||||
|
||||
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
|
||||
#
|
||||
# Oracle JDKs
|
||||
#
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ under the License.
|
|||
<exclude>**/*.log</exclude>
|
||||
<exclude>**/.gitignore</exclude>
|
||||
<exclude>**/.gitattributes</exclude>
|
||||
<exclude>init-git-svn.sh</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
cd .git;wget http://git.apache.org/authors.txt; cd ..
|
||||
git config svn.authorsfile ".git/authors.txt"
|
||||
git svn init --prefix=origin/ --tags=tags --trunk=trunk --branches=branches https://svn.apache.org/repos/asf/maven/maven-3
|
||||
git svn rebase
|
|
@ -37,7 +37,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
|||
* @author Jason van Zyl
|
||||
* @todo this should probably be a component with some dynamic control of filtering
|
||||
*/
|
||||
@Component(role = ArtifactFilterManager.class)
|
||||
@Component( role = ArtifactFilterManager.class )
|
||||
public class DefaultArtifactFilterManager
|
||||
implements ArtifactFilterManager
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ public class DefaultArtifactFilterManager
|
|||
* wagon from their plugin realm.
|
||||
*/
|
||||
|
||||
DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts);
|
||||
DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts );
|
||||
}
|
||||
|
||||
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
package org.apache.maven;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* 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;
|
||||
|
@ -79,26 +83,11 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
import org.sonatype.aether.ConfigurationProperties;
|
||||
import org.sonatype.aether.RepositorySystem;
|
||||
import org.sonatype.aether.RepositorySystemSession;
|
||||
import org.sonatype.aether.collection.DependencyGraphTransformer;
|
||||
import org.sonatype.aether.collection.DependencyManager;
|
||||
import org.sonatype.aether.collection.DependencySelector;
|
||||
import org.sonatype.aether.collection.DependencyTraverser;
|
||||
import org.sonatype.aether.repository.Authentication;
|
||||
import org.sonatype.aether.repository.LocalRepository;
|
||||
import org.sonatype.aether.repository.RepositoryPolicy;
|
||||
import org.sonatype.aether.repository.WorkspaceReader;
|
||||
import org.sonatype.aether.util.DefaultRepositorySystemSession;
|
||||
import org.sonatype.aether.util.graph.manager.ClassicDependencyManager;
|
||||
import org.sonatype.aether.util.graph.selector.AndDependencySelector;
|
||||
import org.sonatype.aether.util.graph.selector.ExclusionDependencySelector;
|
||||
import org.sonatype.aether.util.graph.selector.OptionalDependencySelector;
|
||||
import org.sonatype.aether.util.graph.selector.ScopeDependencySelector;
|
||||
import org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
|
||||
import org.sonatype.aether.util.graph.transformer.NearestVersionConflictResolver;
|
||||
import org.sonatype.aether.util.graph.transformer.ConflictMarker;
|
||||
import org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner;
|
||||
import org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
|
||||
import org.sonatype.aether.util.graph.traverser.FatArtifactTraverser;
|
||||
import org.sonatype.aether.util.repository.ChainedWorkspaceReader;
|
||||
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
||||
import org.sonatype.aether.util.repository.DefaultMirrorSelector;
|
||||
|
@ -107,7 +96,7 @@ import org.sonatype.aether.util.repository.DefaultProxySelector;
|
|||
/**
|
||||
* @author Jason van Zyl
|
||||
*/
|
||||
@Component(role = Maven.class)
|
||||
@Component( role = Maven.class )
|
||||
public class DefaultMaven
|
||||
implements Maven
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.maven.repository.RepositorySystem;
|
|||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
@Component(role = ProjectDependenciesResolver.class)
|
||||
@Component( role = ProjectDependenciesResolver.class )
|
||||
public class DefaultProjectDependenciesResolver
|
||||
implements ProjectDependenciesResolver
|
||||
{
|
||||
|
@ -97,8 +97,8 @@ public class DefaultProjectDependenciesResolver
|
|||
return resolved;
|
||||
}
|
||||
|
||||
if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) &&
|
||||
( scopesToResolve == null || scopesToResolve.isEmpty() ) )
|
||||
if ( ( scopesToCollect == null || scopesToCollect.isEmpty() )
|
||||
&& ( scopesToResolve == null || scopesToResolve.isEmpty() ) )
|
||||
{
|
||||
return resolved;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
package org.apache.maven;
|
||||
|
||||
/*
|
||||
* 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.plugin.MojoFailureException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,9 +43,9 @@ import java.util.Map;
|
|||
class ReactorReader
|
||||
implements WorkspaceReader
|
||||
{
|
||||
private final static Collection<String> JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" );
|
||||
private static final Collection<String> JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" );
|
||||
|
||||
private final static Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
|
||||
private static final Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
|
||||
|
||||
private Map<String, MavenProject> projectsByGAV;
|
||||
|
||||
|
@ -103,7 +103,7 @@ class ReactorReader
|
|||
}
|
||||
else
|
||||
{
|
||||
String type = artifact.getProperty( "type", "");
|
||||
String type = artifact.getProperty( "type", "" );
|
||||
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
|
||||
{
|
||||
return new File( project.getBuild().getOutputDirectory() );
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package org.apache.maven.artifact.repository;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Caches auxiliary data used during repository access like already processed metadata. The data in the cache is meant
|
||||
* for exclusive consumption by the repository system and is opaque to the cache implementation.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
@Deprecated
|
||||
//
|
||||
// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
|
||||
// this here, possibly indefinitely.
|
||||
//
|
||||
public interface RepositoryCache
|
||||
{
|
||||
|
||||
/**
|
||||
* Puts the specified data into the cache. <strong>Warning:</strong> The cache will directly save the provided
|
||||
* reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is
|
||||
* responsible for creating a copy of the original data and store the copy in the cache.
|
||||
*
|
||||
* @param request The repository request from which this cache was retrieved, must not be {@code null}.
|
||||
* @param key The key to use associate the data with, must not be {@code null}.
|
||||
* @param data The data to store in the cache, may be {@code null}.
|
||||
*/
|
||||
void put( RepositoryRequest request, Object key, Object data );
|
||||
|
||||
/**
|
||||
* Gets the specified data from the cache. <strong>Warning:</strong> The cache will directly return the saved
|
||||
* reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy
|
||||
* of the returned data and use this instead of the cache record.
|
||||
*
|
||||
* @param request The repository request from which this cache was retrieved, must not be {@code null}.
|
||||
* @param key The key to use for lookup of the data, must not be {@code null}.
|
||||
* @return The requested data or {@code null} if none was present in the cache.
|
||||
*/
|
||||
Object get( RepositoryRequest request, Object key );
|
||||
|
||||
}
|
|
@ -39,7 +39,7 @@ public interface MetadataReader
|
|||
* The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
|
||||
* true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
|
||||
*/
|
||||
final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict";
|
||||
String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict";
|
||||
|
||||
/**
|
||||
* Reads the metadata from the specified file.
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
|
@ -317,4 +318,12 @@ public class ArtifactResolutionRequest
|
|||
return proxies;
|
||||
}
|
||||
|
||||
//
|
||||
// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
|
||||
// this here, possibly indefinitely.
|
||||
//
|
||||
public ArtifactResolutionRequest setCache( RepositoryCache cache )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,12 @@ public class DefaultClassRealmManager
|
|||
// classworlds (for legacy code)
|
||||
imports.put( "org.codehaus.classworlds", coreRealm );
|
||||
|
||||
// plexus-utils (for DOM-type fields in maven-model)
|
||||
imports.put( "org.codehaus.plexus.util.xml.Xpp3Dom", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlPullParser", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlPullParserException", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlSerializer", coreRealm );
|
||||
|
||||
// plexus-container, plexus-component-annotations
|
||||
imports.put( "org.codehaus.plexus.*", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.component", coreRealm );
|
||||
|
@ -193,17 +199,10 @@ public class DefaultClassRealmManager
|
|||
imports.put( "org.codehaus.plexus.logging", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.personality", coreRealm );
|
||||
|
||||
// plexus-utils (for maven-model)
|
||||
imports.put( "org.codehaus.plexus.util.xml.Xpp3Dom", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlPullParser", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlPullParserException", coreRealm );
|
||||
imports.put( "org.codehaus.plexus.util.xml.pull.XmlSerializer", coreRealm );
|
||||
|
||||
// javax.inject, sisu-inject (JSR-330)
|
||||
imports.put( "javax.inject.*", coreRealm );
|
||||
imports.put( "javax.enterprise.inject.*", coreRealm );
|
||||
imports.put( "org.sonatype.inject.*", coreRealm );
|
||||
imports.put( "org.slf4j.*", coreRealm );
|
||||
|
||||
// com.google
|
||||
//
|
||||
|
@ -218,6 +217,9 @@ public class DefaultClassRealmManager
|
|||
// imports.put( "com.google.inject.name.*", coreRealm );
|
||||
// imports.put( "com.google.inject.spi.*", coreRealm );
|
||||
// imports.put( "com.google.inject.util.*", coreRealm );
|
||||
|
||||
// SLF4J
|
||||
imports.put( "org.slf4j.*", coreRealm );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -179,9 +179,11 @@ public class DefaultExceptionHandler
|
|||
reference = MojoExecutionException.class.getSimpleName();
|
||||
|
||||
Throwable cause = exception.getCause();
|
||||
if ( cause instanceof IOException ) {
|
||||
if ( cause instanceof IOException )
|
||||
{
|
||||
cause = cause.getCause();
|
||||
if ( cause instanceof ConnectException ) {
|
||||
if ( cause instanceof ConnectException )
|
||||
{
|
||||
reference = ConnectException.class.getSimpleName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.monitor.event.EventDispatcher;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -381,4 +382,14 @@ public class MavenSession
|
|||
return repositorySession;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
//
|
||||
// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
|
||||
// this here, possibly indefinitely.
|
||||
//
|
||||
public RepositoryCache getRepositoryCache()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
|
||||
import org.sonatype.aether.RepositorySystemSession;
|
||||
import org.sonatype.aether.graph.DependencyFilter;
|
||||
import org.sonatype.aether.repository.LocalRepository;
|
||||
|
@ -41,7 +43,7 @@ import org.sonatype.aether.repository.WorkspaceRepository;
|
|||
*/
|
||||
@Component( role = PluginRealmCache.class )
|
||||
public class DefaultPluginRealmCache
|
||||
implements PluginRealmCache
|
||||
implements PluginRealmCache, Disposable
|
||||
{
|
||||
|
||||
protected static class CacheKey
|
||||
|
@ -179,6 +181,18 @@ public class DefaultPluginRealmCache
|
|||
|
||||
public void flush()
|
||||
{
|
||||
for ( CacheRecord record : cache.values() )
|
||||
{
|
||||
ClassRealm realm = record.realm;
|
||||
try
|
||||
{
|
||||
realm.getWorld().disposeRealm( realm.getId() );
|
||||
}
|
||||
catch ( NoSuchRealmException e )
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
|
@ -197,4 +211,9 @@ public class DefaultPluginRealmCache
|
|||
// default cache does not track plugin usage
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
flush();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ package org.apache.maven.project;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||
|
@ -31,6 +28,9 @@ import org.codehaus.plexus.component.annotations.Component;
|
|||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Component( role = MavenProjectHelper.class )
|
||||
public class DefaultMavenProjectHelper
|
||||
|
@ -90,20 +90,15 @@ public class DefaultMavenProjectHelper
|
|||
attachArtifact( project, artifact );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an attached artifact or replace the file for an existing artifact.
|
||||
* @see MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
|
||||
* @param project project reference.
|
||||
* @param artifact artifact to add or replace.
|
||||
*/
|
||||
public void attachArtifact( MavenProject project, Artifact artifact )
|
||||
{
|
||||
try
|
||||
{
|
||||
project.addAttachedArtifact( artifact );
|
||||
}
|
||||
catch ( DuplicateArtifactAttachmentException dae )
|
||||
{
|
||||
getLogger().warn( dae.getMessage() );
|
||||
|
||||
// We can throw this because it's unchecked, and won't change the MavenProjectHelper API, which would break
|
||||
// backward compat if it did.
|
||||
throw dae;
|
||||
}
|
||||
project.addAttachedArtifact( artifact );
|
||||
}
|
||||
|
||||
public void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
|
||||
|
|
|
@ -15,22 +15,6 @@ package org.apache.maven.project;
|
|||
* the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
|
@ -75,6 +59,22 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
import org.sonatype.aether.graph.DependencyFilter;
|
||||
import org.sonatype.aether.repository.RemoteRepository;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The concern of the project is provide runtime values based on the model.
|
||||
* <p/>
|
||||
|
@ -1449,19 +1449,46 @@ public class MavenProject
|
|||
return this.injectedProfileIds;
|
||||
}
|
||||
|
||||
private String logStringForArtifactFile( Artifact a )
|
||||
{
|
||||
if ( a.getFile() != null )
|
||||
{
|
||||
return a.getFile().getAbsolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "(no path)";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or replace an artifact.
|
||||
* In spite of the 'throws' declaration on this API, this method has never thrown an exception since Maven 3.0.x.
|
||||
* Historically, it logged and ignored a second addition of the same g/a/v/c/t. Now it replaces the file for
|
||||
* the artifact, so that plugins (e.g. shade) can change the pathname of the file for a particular set of
|
||||
* coordinates.
|
||||
* @param artifact the artifact to add or replace.
|
||||
* @throws DuplicateArtifactAttachmentException
|
||||
*/
|
||||
public void addAttachedArtifact( Artifact artifact )
|
||||
throws DuplicateArtifactAttachmentException
|
||||
{
|
||||
List<Artifact> attachedArtifacts = getAttachedArtifacts();
|
||||
|
||||
if ( attachedArtifacts.contains( artifact ) )
|
||||
for ( int ax = 0; ax < attachedArtifacts.size(); ax++ )
|
||||
{
|
||||
if ( logger != null )
|
||||
Artifact a = attachedArtifacts.get( ax );
|
||||
if ( a.equals( artifact ))
|
||||
{
|
||||
logger.warn( "Artifact " + artifact + " already attached to project, ignoring duplicate" );
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.debug( String.format( "Replacing attached artifact %s. Old path %s, new path %s. ",
|
||||
a,
|
||||
logStringForArtifactFile( a ),
|
||||
logStringForArtifactFile( artifact ) ) );
|
||||
}
|
||||
attachedArtifacts.set( ax, artifact );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
//throw new DuplicateArtifactAttachmentException( this, artifact );
|
||||
}
|
||||
|
||||
getAttachedArtifacts().add( artifact );
|
||||
|
|
|
@ -22,18 +22,54 @@ package org.apache.maven.project;
|
|||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Convenience interface for plugins to add or replace artifacts and resources on projects.
|
||||
*/
|
||||
public interface MavenProjectHelper
|
||||
{
|
||||
String ROLE = MavenProjectHelper.class.getName();
|
||||
|
||||
/**
|
||||
* See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with type set to null.
|
||||
* @param project project reference.
|
||||
* @param artifactFile artifact file.
|
||||
* @param artifactClassifier artifact classifier.
|
||||
*/
|
||||
void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier );
|
||||
|
||||
/**
|
||||
* * See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with classifier set to null.
|
||||
* @param project project reference.
|
||||
* @param artifactType artifact type.
|
||||
* @param artifactFile arrifact file.
|
||||
*/
|
||||
void attachArtifact( MavenProject project, String artifactType, File artifactFile );
|
||||
|
||||
/**
|
||||
* Add or replace an artifact to the current project.
|
||||
* @param project the project reference.
|
||||
* @param artifactType the type (e.g. jar) or null.
|
||||
* @param artifactClassifier the classifier or null.
|
||||
* @param artifactFile the file for the artifact.
|
||||
*/
|
||||
void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile );
|
||||
|
||||
/**
|
||||
* Add a resource directory to the project.
|
||||
* @param project project reference.
|
||||
* @param resourceDirectory directory.
|
||||
* @param includes include patterns.
|
||||
* @param excludes exclude patterns.
|
||||
*/
|
||||
void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes );
|
||||
|
||||
/**
|
||||
* Add a test resource directory to the project.
|
||||
* @param project project reference.
|
||||
* @param resourceDirectory directory.
|
||||
* @param includes include patterns.
|
||||
* @param excludes exclude patterns.
|
||||
*/
|
||||
void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes );
|
||||
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.apache.maven.cli;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
@ -51,7 +49,7 @@ public final class CLIReportingUtils
|
|||
|
||||
public static String showVersion()
|
||||
{
|
||||
String LS = System.getProperty("line.separator");
|
||||
final String LS = System.getProperty( "line.separator" );
|
||||
Properties properties = getBuildProperties();
|
||||
StringBuffer version = new StringBuffer();
|
||||
version.append( createMavenVersionString( properties ) ).append( LS );
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.maven.execution.MavenExecutionResult;
|
|||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder;
|
||||
import org.apache.maven.model.building.ModelProcessor;
|
||||
import org.apache.maven.plugin.PluginRealmCache;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.properties.internal.EnvironmentUtils;
|
||||
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
|
||||
|
@ -112,9 +113,6 @@ public class MavenCli
|
|||
|
||||
private ClassWorld classWorld;
|
||||
|
||||
// Per-instance container supports fast embedded execution of core ITs
|
||||
private DefaultPlexusContainer container;
|
||||
|
||||
private LoggerManager plexusLoggerManager;
|
||||
|
||||
private ILoggerFactory slf4jLoggerFactory;
|
||||
|
@ -197,7 +195,7 @@ public class MavenCli
|
|||
// TODO: need to externalize CliRequest
|
||||
public int doMain( CliRequest cliRequest )
|
||||
{
|
||||
PlexusContainer localContainer = this.container;
|
||||
PlexusContainer localContainer = null;
|
||||
try
|
||||
{
|
||||
initialize( cliRequest );
|
||||
|
@ -235,7 +233,7 @@ public class MavenCli
|
|||
}
|
||||
finally
|
||||
{
|
||||
if ( localContainer != this.container )
|
||||
if (localContainer != null)
|
||||
{
|
||||
localContainer.dispose();
|
||||
}
|
||||
|
@ -285,7 +283,7 @@ public class MavenCli
|
|||
|
||||
if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
|
||||
{
|
||||
System.out.println(CLIReportingUtils.showVersion());
|
||||
System.out.println( CLIReportingUtils.showVersion() );
|
||||
throw new ExitException( 0 );
|
||||
}
|
||||
}
|
||||
|
@ -377,10 +375,8 @@ public class MavenCli
|
|||
cliRequest.classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );
|
||||
}
|
||||
|
||||
DefaultPlexusContainer container = this.container;
|
||||
DefaultPlexusContainer container = null;
|
||||
|
||||
if ( container == null )
|
||||
{
|
||||
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
||||
.setClassWorld( cliRequest.classWorld )
|
||||
.setRealm( setupContainerRealm( cliRequest ) )
|
||||
|
@ -405,12 +401,6 @@ public class MavenCli
|
|||
|
||||
customizeContainer( container );
|
||||
|
||||
if ( cliRequest.classWorld == classWorld )
|
||||
{
|
||||
this.container = container;
|
||||
}
|
||||
}
|
||||
|
||||
container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
|
||||
|
||||
Thread.currentThread().setContextClassLoader( container.getContainerRealm() );
|
||||
|
@ -427,7 +417,7 @@ public class MavenCli
|
|||
eventSpyDispatcher.init( eventSpyContext );
|
||||
|
||||
// refresh logger in case container got customized by spy
|
||||
slf4jLogger = slf4jLoggerFactory.getLogger(this.getClass().getName());
|
||||
slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() );
|
||||
|
||||
maven = container.lookup( Maven.class );
|
||||
|
||||
|
@ -885,7 +875,7 @@ public class MavenCli
|
|||
{
|
||||
transferListener = new QuietMavenTransferListener();
|
||||
}
|
||||
else if ( request.isInteractiveMode() && !cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ))
|
||||
else if ( request.isInteractiveMode() && !cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
|
||||
{
|
||||
//
|
||||
// If we're logging to a file then we don't want the console transfer listener as it will spew
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.apache.maven.cli.transfer;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -21,6 +19,8 @@ import java.io.PrintStream;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class BatchModeMavenTransferListener
|
||||
extends AbstractMavenTransferListener
|
||||
{
|
||||
|
|
|
@ -24,7 +24,11 @@ Maven Logging
|
|||
|
||||
Plexus Logger can be injected in Plexus component using Plexus annotations
|
||||
|
||||
<<<<<<< HEAD
|
||||
+------
|
||||
=======
|
||||
+------+
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
@ -36,11 +40,16 @@ public class DefaultMyComponent
|
|||
@Requirement
|
||||
private Logger logger;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
+------
|
||||
=======
|
||||
+------+
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
|
||||
Starting with Maven 3.1.0, SLF4J Logger can be used directly too, without Plexus. Of course, this will only work when run under
|
||||
Maven 3.1.0, then this technique can be used safely only in Maven core components.
|
||||
|
||||
<<<<<<< HEAD
|
||||
+-----
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -50,6 +59,17 @@ public class Wombat
|
|||
final Logger logger = LoggerFactory.getLogger(Wombat.class);
|
||||
}
|
||||
+-----
|
||||
=======
|
||||
+-----+
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MyClass
|
||||
{
|
||||
final Logger logger = LoggerFactory.getLogger( MyClass.class );
|
||||
}
|
||||
+-----+
|
||||
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||
|
||||
* Logger Name
|
||||
|
||||
|
|
Loading…
Reference in New Issue