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
|
case "`uname`" in
|
||||||
CYGWIN*) cygwin=true ;;
|
CYGWIN*) cygwin=true ;;
|
||||||
MINGW*) mingw=true;;
|
MINGW*) mingw=true;;
|
||||||
|
<<<<<<< HEAD
|
||||||
Darwin*) darwin=true
|
Darwin*) darwin=true
|
||||||
|
|
||||||
|
=======
|
||||||
|
Darwin*) darwin=true
|
||||||
|
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||||
#
|
#
|
||||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||||
# for the new JDKs provided by Oracle.
|
# 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
|
if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
|
||||||
#
|
#
|
||||||
# Apple JDKs
|
# Apple JDKs
|
||||||
#
|
#
|
||||||
|
<<<<<<< HEAD
|
||||||
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -71,6 +86,16 @@ case "`uname`" in
|
||||||
# Oracle JDKs
|
# Oracle JDKs
|
||||||
#
|
#
|
||||||
JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
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
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -58,12 +58,30 @@ case "`uname`" in
|
||||||
CYGWIN*) cygwin=true ;;
|
CYGWIN*) cygwin=true ;;
|
||||||
MINGW*) mingw=true;;
|
MINGW*) mingw=true;;
|
||||||
Darwin*) darwin=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
|
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
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
|
||||||
|
#
|
||||||
|
# Oracle JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -61,17 +61,31 @@ mingw=false
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN*) cygwin=true ;;
|
CYGWIN*) cygwin=true ;;
|
||||||
MINGW*) mingw=true;;
|
MINGW*) mingw=true;;
|
||||||
Darwin*) darwin=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
|
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
|
fi
|
||||||
if [ -z "$YJP_HOME" ]; then
|
|
||||||
YJP_HOME=/Applications/YourKit.app
|
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
|
||||||
fi
|
#
|
||||||
YJPLIB=$YJP_HOME/bin/mac/libyjpagent.jnilib
|
# Oracle JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ under the License.
|
||||||
<exclude>**/*.log</exclude>
|
<exclude>**/*.log</exclude>
|
||||||
<exclude>**/.gitignore</exclude>
|
<exclude>**/.gitignore</exclude>
|
||||||
<exclude>**/.gitattributes</exclude>
|
<exclude>**/.gitattributes</exclude>
|
||||||
|
<exclude>init-git-svn.sh</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<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
|
* @author Jason van Zyl
|
||||||
* @todo this should probably be a component with some dynamic control of filtering
|
* @todo this should probably be a component with some dynamic control of filtering
|
||||||
*/
|
*/
|
||||||
@Component(role = ArtifactFilterManager.class)
|
@Component( role = ArtifactFilterManager.class )
|
||||||
public class DefaultArtifactFilterManager
|
public class DefaultArtifactFilterManager
|
||||||
implements ArtifactFilterManager
|
implements ArtifactFilterManager
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ public class DefaultArtifactFilterManager
|
||||||
* wagon from their plugin realm.
|
* wagon from their plugin realm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts);
|
DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );
|
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
package org.apache.maven;
|
package org.apache.maven;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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;
|
||||||
|
@ -79,26 +83,11 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
import org.sonatype.aether.ConfigurationProperties;
|
import org.sonatype.aether.ConfigurationProperties;
|
||||||
import org.sonatype.aether.RepositorySystem;
|
import org.sonatype.aether.RepositorySystem;
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
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.Authentication;
|
||||||
import org.sonatype.aether.repository.LocalRepository;
|
import org.sonatype.aether.repository.LocalRepository;
|
||||||
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.util.DefaultRepositorySystemSession;
|
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.ChainedWorkspaceReader;
|
||||||
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
||||||
import org.sonatype.aether.util.repository.DefaultMirrorSelector;
|
import org.sonatype.aether.util.repository.DefaultMirrorSelector;
|
||||||
|
@ -107,7 +96,7 @@ import org.sonatype.aether.util.repository.DefaultProxySelector;
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
@Component(role = Maven.class)
|
@Component( role = Maven.class )
|
||||||
public class DefaultMaven
|
public class DefaultMaven
|
||||||
implements Maven
|
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.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
|
||||||
@Component(role = ProjectDependenciesResolver.class)
|
@Component( role = ProjectDependenciesResolver.class )
|
||||||
public class DefaultProjectDependenciesResolver
|
public class DefaultProjectDependenciesResolver
|
||||||
implements ProjectDependenciesResolver
|
implements ProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
|
@ -97,8 +97,8 @@ public class DefaultProjectDependenciesResolver
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) &&
|
if ( ( scopesToCollect == null || scopesToCollect.isEmpty() )
|
||||||
( scopesToResolve == null || scopesToResolve.isEmpty() ) )
|
&& ( scopesToResolve == null || scopesToResolve.isEmpty() ) )
|
||||||
{
|
{
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
package org.apache.maven;
|
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;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,9 +43,9 @@ import java.util.Map;
|
||||||
class ReactorReader
|
class ReactorReader
|
||||||
implements WorkspaceReader
|
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;
|
private Map<String, MavenProject> projectsByGAV;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class ReactorReader
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String type = artifact.getProperty( "type", "");
|
String type = artifact.getProperty( "type", "" );
|
||||||
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
|
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
|
||||||
{
|
{
|
||||||
return new File( project.getBuild().getOutputDirectory() );
|
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
|
* 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.
|
* 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.
|
* 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.Artifact;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.repository.RepositoryRequest;
|
||||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||||
import org.apache.maven.settings.Mirror;
|
import org.apache.maven.settings.Mirror;
|
||||||
|
@ -317,4 +318,12 @@ public class ArtifactResolutionRequest
|
||||||
return proxies;
|
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)
|
// classworlds (for legacy code)
|
||||||
imports.put( "org.codehaus.classworlds", coreRealm );
|
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
|
// plexus-container, plexus-component-annotations
|
||||||
imports.put( "org.codehaus.plexus.*", coreRealm );
|
imports.put( "org.codehaus.plexus.*", coreRealm );
|
||||||
imports.put( "org.codehaus.plexus.component", 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.logging", coreRealm );
|
||||||
imports.put( "org.codehaus.plexus.personality", 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)
|
// javax.inject, sisu-inject (JSR-330)
|
||||||
imports.put( "javax.inject.*", coreRealm );
|
imports.put( "javax.inject.*", coreRealm );
|
||||||
imports.put( "javax.enterprise.inject.*", coreRealm );
|
imports.put( "javax.enterprise.inject.*", coreRealm );
|
||||||
imports.put( "org.sonatype.inject.*", coreRealm );
|
imports.put( "org.sonatype.inject.*", coreRealm );
|
||||||
imports.put( "org.slf4j.*", coreRealm );
|
|
||||||
|
|
||||||
// com.google
|
// com.google
|
||||||
//
|
//
|
||||||
|
@ -218,6 +217,9 @@ public class DefaultClassRealmManager
|
||||||
// imports.put( "com.google.inject.name.*", coreRealm );
|
// imports.put( "com.google.inject.name.*", coreRealm );
|
||||||
// imports.put( "com.google.inject.spi.*", coreRealm );
|
// imports.put( "com.google.inject.spi.*", coreRealm );
|
||||||
// imports.put( "com.google.inject.util.*", 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();
|
reference = MojoExecutionException.class.getSimpleName();
|
||||||
|
|
||||||
Throwable cause = exception.getCause();
|
Throwable cause = exception.getCause();
|
||||||
if ( cause instanceof IOException ) {
|
if ( cause instanceof IOException )
|
||||||
|
{
|
||||||
cause = cause.getCause();
|
cause = cause.getCause();
|
||||||
if ( cause instanceof ConnectException ) {
|
if ( cause instanceof ConnectException )
|
||||||
|
{
|
||||||
reference = ConnectException.class.getSimpleName();
|
reference = ConnectException.class.getSimpleName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.monitor.event.EventDispatcher;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
@ -381,4 +382,14 @@ public class MavenSession
|
||||||
return repositorySession;
|
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.model.Plugin;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
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.component.annotations.Component;
|
||||||
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
import org.sonatype.aether.graph.DependencyFilter;
|
import org.sonatype.aether.graph.DependencyFilter;
|
||||||
import org.sonatype.aether.repository.LocalRepository;
|
import org.sonatype.aether.repository.LocalRepository;
|
||||||
|
@ -41,7 +43,7 @@ import org.sonatype.aether.repository.WorkspaceRepository;
|
||||||
*/
|
*/
|
||||||
@Component( role = PluginRealmCache.class )
|
@Component( role = PluginRealmCache.class )
|
||||||
public class DefaultPluginRealmCache
|
public class DefaultPluginRealmCache
|
||||||
implements PluginRealmCache
|
implements PluginRealmCache, Disposable
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static class CacheKey
|
protected static class CacheKey
|
||||||
|
@ -179,6 +181,18 @@ public class DefaultPluginRealmCache
|
||||||
|
|
||||||
public void flush()
|
public void flush()
|
||||||
{
|
{
|
||||||
|
for ( CacheRecord record : cache.values() )
|
||||||
|
{
|
||||||
|
ClassRealm realm = record.realm;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
realm.getWorld().disposeRealm( realm.getId() );
|
||||||
|
}
|
||||||
|
catch ( NoSuchRealmException e )
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
cache.clear();
|
cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,4 +211,9 @@ public class DefaultPluginRealmCache
|
||||||
// default cache does not track plugin usage
|
// default cache does not track plugin usage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@ package org.apache.maven.project;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
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.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
@SuppressWarnings( "deprecation" )
|
||||||
@Component( role = MavenProjectHelper.class )
|
@Component( role = MavenProjectHelper.class )
|
||||||
public class DefaultMavenProjectHelper
|
public class DefaultMavenProjectHelper
|
||||||
|
@ -90,20 +90,15 @@ public class DefaultMavenProjectHelper
|
||||||
attachArtifact( project, artifact );
|
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 )
|
public void attachArtifact( MavenProject project, Artifact artifact )
|
||||||
{
|
{
|
||||||
try
|
project.addAttachedArtifact( artifact );
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
|
public void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
|
||||||
|
|
|
@ -15,22 +15,6 @@ package org.apache.maven.project;
|
||||||
* the License.
|
* 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.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;
|
||||||
|
@ -75,6 +59,22 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
import org.sonatype.aether.graph.DependencyFilter;
|
import org.sonatype.aether.graph.DependencyFilter;
|
||||||
import org.sonatype.aether.repository.RemoteRepository;
|
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.
|
* The concern of the project is provide runtime values based on the model.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -1449,19 +1449,46 @@ public class MavenProject
|
||||||
return this.injectedProfileIds;
|
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 )
|
public void addAttachedArtifact( Artifact artifact )
|
||||||
throws DuplicateArtifactAttachmentException
|
throws DuplicateArtifactAttachmentException
|
||||||
{
|
{
|
||||||
List<Artifact> attachedArtifacts = getAttachedArtifacts();
|
List<Artifact> attachedArtifacts = getAttachedArtifacts();
|
||||||
|
for ( int ax = 0; ax < attachedArtifacts.size(); ax++ )
|
||||||
if ( attachedArtifacts.contains( artifact ) )
|
|
||||||
{
|
{
|
||||||
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 );
|
getAttachedArtifacts().add( artifact );
|
||||||
|
|
|
@ -22,18 +22,54 @@ package org.apache.maven.project;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience interface for plugins to add or replace artifacts and resources on projects.
|
||||||
|
*/
|
||||||
public interface MavenProjectHelper
|
public interface MavenProjectHelper
|
||||||
{
|
{
|
||||||
String ROLE = MavenProjectHelper.class.getName();
|
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 );
|
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 );
|
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 );
|
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 );
|
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 );
|
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.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -51,7 +49,7 @@ public final class CLIReportingUtils
|
||||||
|
|
||||||
public static String showVersion()
|
public static String showVersion()
|
||||||
{
|
{
|
||||||
String LS = System.getProperty("line.separator");
|
final String LS = System.getProperty( "line.separator" );
|
||||||
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 );
|
||||||
|
|
|
@ -55,6 +55,7 @@ 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;
|
||||||
|
@ -112,9 +113,6 @@ public class MavenCli
|
||||||
|
|
||||||
private ClassWorld classWorld;
|
private ClassWorld classWorld;
|
||||||
|
|
||||||
// Per-instance container supports fast embedded execution of core ITs
|
|
||||||
private DefaultPlexusContainer container;
|
|
||||||
|
|
||||||
private LoggerManager plexusLoggerManager;
|
private LoggerManager plexusLoggerManager;
|
||||||
|
|
||||||
private ILoggerFactory slf4jLoggerFactory;
|
private ILoggerFactory slf4jLoggerFactory;
|
||||||
|
@ -197,7 +195,7 @@ public class MavenCli
|
||||||
// TODO: need to externalize CliRequest
|
// TODO: need to externalize CliRequest
|
||||||
public int doMain( CliRequest cliRequest )
|
public int doMain( CliRequest cliRequest )
|
||||||
{
|
{
|
||||||
PlexusContainer localContainer = this.container;
|
PlexusContainer localContainer = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
initialize( cliRequest );
|
initialize( cliRequest );
|
||||||
|
@ -235,7 +233,7 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if ( localContainer != this.container )
|
if (localContainer != null)
|
||||||
{
|
{
|
||||||
localContainer.dispose();
|
localContainer.dispose();
|
||||||
}
|
}
|
||||||
|
@ -285,7 +283,7 @@ public class MavenCli
|
||||||
|
|
||||||
if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
|
if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
|
||||||
{
|
{
|
||||||
System.out.println(CLIReportingUtils.showVersion());
|
System.out.println( CLIReportingUtils.showVersion() );
|
||||||
throw new ExitException( 0 );
|
throw new ExitException( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,10 +375,8 @@ public class MavenCli
|
||||||
cliRequest.classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );
|
cliRequest.classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultPlexusContainer container = this.container;
|
DefaultPlexusContainer container = null;
|
||||||
|
|
||||||
if ( container == null )
|
|
||||||
{
|
|
||||||
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
||||||
.setClassWorld( cliRequest.classWorld )
|
.setClassWorld( cliRequest.classWorld )
|
||||||
.setRealm( setupContainerRealm( cliRequest ) )
|
.setRealm( setupContainerRealm( cliRequest ) )
|
||||||
|
@ -405,12 +401,6 @@ public class MavenCli
|
||||||
|
|
||||||
customizeContainer( container );
|
customizeContainer( container );
|
||||||
|
|
||||||
if ( cliRequest.classWorld == classWorld )
|
|
||||||
{
|
|
||||||
this.container = container;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
|
container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
|
||||||
|
|
||||||
Thread.currentThread().setContextClassLoader( container.getContainerRealm() );
|
Thread.currentThread().setContextClassLoader( container.getContainerRealm() );
|
||||||
|
@ -427,7 +417,7 @@ public class MavenCli
|
||||||
eventSpyDispatcher.init( eventSpyContext );
|
eventSpyDispatcher.init( eventSpyContext );
|
||||||
|
|
||||||
// refresh logger in case container got customized by spy
|
// 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 );
|
maven = container.lookup( Maven.class );
|
||||||
|
|
||||||
|
@ -885,7 +875,7 @@ public class MavenCli
|
||||||
{
|
{
|
||||||
transferListener = new QuietMavenTransferListener();
|
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
|
// 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;
|
package org.apache.maven.cli.transfer;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
@ -21,6 +19,8 @@ import java.io.PrintStream;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class BatchModeMavenTransferListener
|
public class BatchModeMavenTransferListener
|
||||||
extends AbstractMavenTransferListener
|
extends AbstractMavenTransferListener
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,11 @@ Maven Logging
|
||||||
|
|
||||||
Plexus Logger can be injected in Plexus component using Plexus annotations
|
Plexus Logger can be injected in Plexus component using Plexus annotations
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
+------
|
+------
|
||||||
|
=======
|
||||||
|
+------+
|
||||||
|
>>>>>>> fcffe3c9d5ceb65c229b07f60ad4d215f5cd05e2
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
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;
|
||||||
|
@ -36,11 +40,16 @@ public class DefaultMyComponent
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
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
|
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.
|
Maven 3.1.0, then this technique can be used safely only in Maven core components.
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
+-----
|
+-----
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -50,6 +59,17 @@ public class Wombat
|
||||||
final Logger logger = LoggerFactory.getLogger(Wombat.class);
|
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
|
* Logger Name
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue