mirror of https://github.com/apache/maven.git
[MNG-5719] renamed JavaToolChain to JavaToolchain for consistency and
removed its Plexus component declaration
This commit is contained in:
parent
fa4f7040ad
commit
b013d97ceb
|
@ -23,7 +23,6 @@ import java.io.File;
|
||||||
|
|
||||||
import org.apache.maven.toolchain.DefaultToolchain;
|
import org.apache.maven.toolchain.DefaultToolchain;
|
||||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.codehaus.plexus.util.Os;
|
import org.codehaus.plexus.util.Os;
|
||||||
|
@ -32,16 +31,15 @@ import org.codehaus.plexus.util.Os;
|
||||||
* @author Milos Kleint
|
* @author Milos Kleint
|
||||||
* @since 2.0.9
|
* @since 2.0.9
|
||||||
*/
|
*/
|
||||||
@Component( role = JavaToolChain.class )
|
public class DefaultJavaToolchain
|
||||||
public class DefaultJavaToolChain
|
|
||||||
extends DefaultToolchain
|
extends DefaultToolchain
|
||||||
implements JavaToolChain
|
implements JavaToolchain
|
||||||
{
|
{
|
||||||
private String javaHome;
|
private String javaHome;
|
||||||
|
|
||||||
public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N
|
public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N
|
||||||
|
|
||||||
public DefaultJavaToolChain( ToolchainModel model, Logger logger )
|
public DefaultJavaToolchain( ToolchainModel model, Logger logger )
|
||||||
{
|
{
|
||||||
super( model, "jdk", logger );
|
super( model, "jdk", logger );
|
||||||
}
|
}
|
|
@ -58,13 +58,13 @@ public class DefaultJavaToolchainFactory
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
DefaultJavaToolChain jtc = new DefaultJavaToolChain( model, logger );
|
DefaultJavaToolchain jtc = new DefaultJavaToolchain( model, logger );
|
||||||
Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
|
Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
|
||||||
Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME );
|
Xpp3Dom javahome = dom.getChild( DefaultJavaToolchain.KEY_JAVAHOME );
|
||||||
if ( javahome == null )
|
if ( javahome == null )
|
||||||
{
|
{
|
||||||
throw new MisconfiguredToolchainException( "Java toolchain without the "
|
throw new MisconfiguredToolchainException( "Java toolchain without the "
|
||||||
+ DefaultJavaToolChain.KEY_JAVAHOME + " configuration element." );
|
+ DefaultJavaToolchain.KEY_JAVAHOME + " configuration element." );
|
||||||
}
|
}
|
||||||
File normal = new File( FileUtils.normalize( javahome.getValue() ) );
|
File normal = new File( FileUtils.normalize( javahome.getValue() ) );
|
||||||
if ( normal.exists() )
|
if ( normal.exists() )
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.maven.toolchain.Toolchain;
|
||||||
* @author Milos Kleint
|
* @author Milos Kleint
|
||||||
* @since 2.0.9
|
* @since 2.0.9
|
||||||
*/
|
*/
|
||||||
public interface JavaToolChain
|
public interface JavaToolchain
|
||||||
extends Toolchain
|
extends Toolchain
|
||||||
{
|
{
|
||||||
// /**
|
// /**
|
|
@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.maven.toolchain.java.DefaultJavaToolChain;
|
import org.apache.maven.toolchain.java.DefaultJavaToolchain;
|
||||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||||
import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
|
import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
|
||||||
|
@ -48,8 +48,8 @@ public class DefaultToolchainTest
|
||||||
PersistedToolchains jdks = reader.read( jdksIS );
|
PersistedToolchains jdks = reader.read( jdksIS );
|
||||||
PersistedToolchains jdksExtra = reader.read( jdksExtraIS );
|
PersistedToolchains jdksExtra = reader.read( jdksExtraIS );
|
||||||
|
|
||||||
DefaultJavaToolChain tc1 = new DefaultJavaToolChain( jdks.getToolchains().get( 0 ), null );
|
DefaultJavaToolchain tc1 = new DefaultJavaToolchain( jdks.getToolchains().get( 0 ), null );
|
||||||
DefaultJavaToolChain tc2 = new DefaultJavaToolChain( jdksExtra.getToolchains().get( 0 ), null );
|
DefaultJavaToolchain tc2 = new DefaultJavaToolchain( jdksExtra.getToolchains().get( 0 ), null );
|
||||||
|
|
||||||
assertTrue( tc1.equals( tc1 ) );
|
assertTrue( tc1.equals( tc1 ) );
|
||||||
assertFalse( tc1.equals( tc2 ) );
|
assertFalse( tc1.equals( tc2 ) );
|
||||||
|
|
Loading…
Reference in New Issue