Repository: maven Updated Branches: refs/heads/master fa4f7040a -> b013d97ce
[MNG-5719] renamed JavaToolChain to JavaToolchain for consistency and removed its Plexus component declaration Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/b013d97c Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/b013d97c Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/b013d97c Branch: refs/heads/master Commit: b013d97ceb565f4bbc61dd0c3582ecfc2c3c8b67 Parents: fa4f704 Author: Hervé Boutemy <hbout...@apache.org> Authored: Tue Nov 4 00:58:27 2014 +0100 Committer: Hervé Boutemy <hbout...@apache.org> Committed: Tue Nov 4 00:58:27 2014 +0100 ---------------------------------------------------------------------- .../toolchain/java/DefaultJavaToolChain.java | 87 -------------------- .../toolchain/java/DefaultJavaToolchain.java | 85 +++++++++++++++++++ .../java/DefaultJavaToolchainFactory.java | 6 +- .../maven/toolchain/java/JavaToolChain.java | 65 --------------- .../maven/toolchain/java/JavaToolchain.java | 65 +++++++++++++++ .../maven/toolchain/DefaultToolchainTest.java | 6 +- 6 files changed, 156 insertions(+), 158 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java deleted file mode 100644 index 9dc92f8..0000000 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.apache.maven.toolchain.java; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -import 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; - -/** - * @author Milos Kleint - * @since 2.0.9 - */ -@Component( role = JavaToolChain.class ) -public class DefaultJavaToolChain - extends DefaultToolchain - implements JavaToolChain -{ - private String javaHome; - - public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N - - public DefaultJavaToolChain( ToolchainModel model, Logger logger ) - { - super( model, "jdk", logger ); - } - - public String getJavaHome() - { - return javaHome; - } - - public void setJavaHome( String javaHome ) - { - this.javaHome = javaHome; - } - - public String toString() - { - return "JDK[" + getJavaHome() + "]"; - } - - public String findTool( String toolName ) - { - File toRet = findTool( toolName, new File( FileUtils.normalize( getJavaHome() ) ) ); - if ( toRet != null ) - { - return toRet.getAbsolutePath(); - } - return null; - } - - private static File findTool( String toolName, File installFolder ) - { - File bin = new File( installFolder, "bin" ); //NOI18N - if ( bin.exists() ) - { - File tool = new File( bin, toolName + ( Os.isFamily( "windows" ) ? ".exe" : "" ) ); // NOI18N - if ( tool.exists() ) - { - return tool; - } - } - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchain.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchain.java new file mode 100644 index 0000000..5364d67 --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchain.java @@ -0,0 +1,85 @@ +package org.apache.maven.toolchain.java; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.toolchain.DefaultToolchain; +import org.apache.maven.toolchain.model.ToolchainModel; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.Os; + +/** + * @author Milos Kleint + * @since 2.0.9 + */ +public class DefaultJavaToolchain + extends DefaultToolchain + implements JavaToolchain +{ + private String javaHome; + + public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N + + public DefaultJavaToolchain( ToolchainModel model, Logger logger ) + { + super( model, "jdk", logger ); + } + + public String getJavaHome() + { + return javaHome; + } + + public void setJavaHome( String javaHome ) + { + this.javaHome = javaHome; + } + + public String toString() + { + return "JDK[" + getJavaHome() + "]"; + } + + public String findTool( String toolName ) + { + File toRet = findTool( toolName, new File( FileUtils.normalize( getJavaHome() ) ) ); + if ( toRet != null ) + { + return toRet.getAbsolutePath(); + } + return null; + } + + private static File findTool( String toolName, File installFolder ) + { + File bin = new File( installFolder, "bin" ); //NOI18N + if ( bin.exists() ) + { + File tool = new File( bin, toolName + ( Os.isFamily( "windows" ) ? ".exe" : "" ) ); // NOI18N + if ( tool.exists() ) + { + return tool; + } + } + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java index f213086..3a9d213 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java @@ -58,13 +58,13 @@ public class DefaultJavaToolchainFactory { return null; } - DefaultJavaToolChain jtc = new DefaultJavaToolChain( model, logger ); + DefaultJavaToolchain jtc = new DefaultJavaToolchain( model, logger ); Xpp3Dom dom = (Xpp3Dom) model.getConfiguration(); - Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME ); + Xpp3Dom javahome = dom.getChild( DefaultJavaToolchain.KEY_JAVAHOME ); if ( javahome == null ) { 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() ) ); if ( normal.exists() ) http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java deleted file mode 100644 index a9c5bbf..0000000 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.maven.toolchain.java; - -/* - * 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.toolchain.Toolchain; - -/** - * @author Jason van Zyl - * @author Milos Kleint - * @since 2.0.9 - */ -public interface JavaToolChain - extends Toolchain -{ -// /** -// * Returns a list of {@link java.io.File}s which represents the bootstrap libraries for the -// * runtime environment. The Bootstrap libraries include libraries in JRE's -// * extension directory, if there are any. -// * -// * @return List -// */ -// List getBootstrapLibraries(); -// -// /** -// * Returns a list of {@link java.io.File}s which represent the libraries recognized by -// * default by the platform. Usually it corresponds to contents of CLASSPATH -// * environment variable. -// * -// * @return List -// */ -// List getStandardLibraries(); -// -// /** -// * Returns a {@link java.io.File}s which represent the locations of the source of the JDK, -// * or an empty collection when the location is not set or is invalid. -// * -// * @return List -// */ -// List getSourceDirectories(); -// -// /** -// * Returns a {@link java.io.File}s which represent the locations of the Javadoc for this platform, -// * or empty collection if the location is not set or invalid -// * -// * @return List -// */ -// List getJavadocFolders(); -} http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java new file mode 100644 index 0000000..20b3624 --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java @@ -0,0 +1,65 @@ +package org.apache.maven.toolchain.java; + +/* + * 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.toolchain.Toolchain; + +/** + * @author Jason van Zyl + * @author Milos Kleint + * @since 2.0.9 + */ +public interface JavaToolchain + extends Toolchain +{ +// /** +// * Returns a list of {@link java.io.File}s which represents the bootstrap libraries for the +// * runtime environment. The Bootstrap libraries include libraries in JRE's +// * extension directory, if there are any. +// * +// * @return List +// */ +// List getBootstrapLibraries(); +// +// /** +// * Returns a list of {@link java.io.File}s which represent the libraries recognized by +// * default by the platform. Usually it corresponds to contents of CLASSPATH +// * environment variable. +// * +// * @return List +// */ +// List getStandardLibraries(); +// +// /** +// * Returns a {@link java.io.File}s which represent the locations of the source of the JDK, +// * or an empty collection when the location is not set or is invalid. +// * +// * @return List +// */ +// List getSourceDirectories(); +// +// /** +// * Returns a {@link java.io.File}s which represent the locations of the Javadoc for this platform, +// * or empty collection if the location is not set or invalid +// * +// * @return List +// */ +// List getJavadocFolders(); +} http://git-wip-us.apache.org/repos/asf/maven/blob/b013d97c/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java ---------------------------------------------------------------------- diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java index 8de350b..c0470cd 100644 --- a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java +++ b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue; 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.ToolchainModel; import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader; @@ -48,8 +48,8 @@ public class DefaultToolchainTest PersistedToolchains jdks = reader.read( jdksIS ); PersistedToolchains jdksExtra = reader.read( jdksExtraIS ); - DefaultJavaToolChain tc1 = new DefaultJavaToolChain( jdks.getToolchains().get( 0 ), null ); - DefaultJavaToolChain tc2 = new DefaultJavaToolChain( jdksExtra.getToolchains().get( 0 ), null ); + DefaultJavaToolchain tc1 = new DefaultJavaToolchain( jdks.getToolchains().get( 0 ), null ); + DefaultJavaToolchain tc2 = new DefaultJavaToolchain( jdksExtra.getToolchains().get( 0 ), null ); assertTrue( tc1.equals( tc1 ) ); assertFalse( tc1.equals( tc2 ) );