mirror of https://github.com/apache/maven.git
o use annotations
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@746431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
41001b509d
commit
a85440fe92
|
@ -40,6 +40,8 @@ import org.apache.maven.toolchain.model.ToolchainModel;
|
|||
import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
import org.codehaus.plexus.context.ContextException;
|
||||
|
@ -50,27 +52,18 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
|||
*
|
||||
* @author mkleint
|
||||
*/
|
||||
@Component(role=ToolchainManager.class)
|
||||
public class DefaultToolchainManager extends AbstractLogEnabled
|
||||
implements ToolchainManager,
|
||||
ToolchainManagerPrivate,
|
||||
Contextualizable
|
||||
ToolchainManagerPrivate
|
||||
{
|
||||
|
||||
/**
|
||||
* @component
|
||||
*/
|
||||
@Requirement
|
||||
private PlexusContainer container;
|
||||
|
||||
public DefaultToolchainManager( )
|
||||
{
|
||||
}
|
||||
|
||||
public void contextualize( Context context )
|
||||
throws ContextException
|
||||
{
|
||||
container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
|
||||
}
|
||||
|
||||
public ToolchainPrivate[] getToolchainsForType( String type )
|
||||
throws MisconfiguredToolchainException
|
||||
{
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.apache.maven.artifact.versioning.VersionRange;
|
|||
*/
|
||||
public final class RequirementMatcherFactory
|
||||
{
|
||||
|
||||
private RequirementMatcherFactory( )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@ import org.apache.maven.toolchain.model.ToolchainModel;
|
|||
*/
|
||||
public interface ToolchainFactory
|
||||
{
|
||||
|
||||
String ROLE = ToolchainFactory.class.getName();
|
||||
|
||||
/**
|
||||
* Create instance of toolchain.
|
||||
**/
|
||||
|
|
|
@ -28,14 +28,9 @@ import org.apache.maven.execution.MavenSession;
|
|||
*/
|
||||
public interface ToolchainManager
|
||||
{
|
||||
|
||||
String ROLE = ToolchainManager.class.getName();
|
||||
|
||||
|
||||
/**
|
||||
* to be used from plugins capable of working with toolchains.
|
||||
*/
|
||||
Toolchain getToolchainFromBuildContext( String type,
|
||||
MavenSession context );
|
||||
|
||||
}
|
|
@ -29,8 +29,6 @@ import org.apache.maven.execution.MavenSession;
|
|||
*/
|
||||
public interface ToolchainManagerPrivate
|
||||
{
|
||||
String ROLE = ToolchainManagerPrivate.class.getName();
|
||||
|
||||
/**
|
||||
* Retrieves the toolchains of given type from the user settings.
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.maven.toolchain.java;
|
|||
import java.io.File;
|
||||
import org.apache.maven.toolchain.DefaultToolchain;
|
||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.Os;
|
||||
|
@ -29,11 +30,11 @@ import org.codehaus.plexus.util.Os;
|
|||
/**
|
||||
* @author Milos Kleint
|
||||
*/
|
||||
@Component(role=JavaToolChain.class)
|
||||
public class DefaultJavaToolChain
|
||||
extends DefaultToolchain
|
||||
implements JavaToolChain
|
||||
{
|
||||
|
||||
private String javaHome;
|
||||
|
||||
public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N
|
||||
|
@ -69,7 +70,6 @@ public class DefaultJavaToolChain
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static File findTool( String toolName, File installFolder )
|
||||
{
|
||||
File bin = new File( installFolder, "bin" ); //NOI18N
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.maven.toolchain.RequirementMatcherFactory;
|
|||
import org.apache.maven.toolchain.ToolchainFactory;
|
||||
import org.apache.maven.toolchain.ToolchainPrivate;
|
||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.logging.LogEnabled;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
@ -34,10 +35,10 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
*
|
||||
* @author mkleint
|
||||
*/
|
||||
@Component(role=ToolchainFactory.class)
|
||||
public class DefaultJavaToolchainFactory
|
||||
implements ToolchainFactory, LogEnabled
|
||||
{
|
||||
|
||||
private Logger logger;
|
||||
|
||||
public DefaultJavaToolchainFactory( )
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.toolchain.ToolchainManager</role>
|
||||
<implementation>org.apache.maven.toolchain.DefaultToolchainManager</implementation>
|
||||
</component>
|
||||
<!--- TODO do I really need to define 2 components? I'd rather have 1 istance shared for both lookups. -->
|
||||
<component>
|
||||
<role>org.apache.maven.toolchain.ToolchainManagerPrivate</role>
|
||||
<implementation>org.apache.maven.toolchain.DefaultToolchainManager</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.toolchain.ToolchainFactory</role>
|
||||
<role-hint>jdk</role-hint>
|
||||
<implementation>org.apache.maven.toolchain.java.DefaultJavaToolchainFactory</implementation>
|
||||
</component>
|
||||
|
||||
<!-- make sure the compiler-plugin gets the jdk toolchain -->
|
||||
<component>
|
||||
<role>org.apache.maven.toolchain.ToolchainFactory</role>
|
||||
<role-hint>javac</role-hint>
|
||||
<implementation>org.apache.maven.toolchain.java.DefaultJavaToolchainFactory</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
Loading…
Reference in New Issue