Search in sources :

Example 6 with DefaultJavaToolChain

use of org.apache.maven.toolchain.java.DefaultJavaToolChain in project tycho by eclipse.

the class AbstractOsgiCompilerMojo method configureJavaHome.

private void configureJavaHome(CompilerConfiguration compilerConfiguration) throws MojoExecutionException {
    if (useJDK != JDKUsage.BREE) {
        return;
    }
    String toolchainId = getTargetExecutionEnvironment().getProfileName();
    DefaultJavaToolChain toolChain = toolchainProvider.findMatchingJavaToolChain(session, toolchainId);
    if (toolChain == null) {
        throw new MojoExecutionException("useJDK = BREE configured, but no toolchain of type 'jdk' with id '" + toolchainId + "' found. See http://maven.apache.org/guides/mini/guide-using-toolchains.html");
    }
    compilerConfiguration.addCompilerCustomArgument("use.java.home", toolChain.getJavaHome());
    configureBootClassPath(compilerConfiguration, toolChain);
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) DefaultJavaToolChain(org.apache.maven.toolchain.java.DefaultJavaToolChain)

Aggregations

DefaultJavaToolChain (org.apache.maven.toolchain.java.DefaultJavaToolChain)6 Toolchain (org.apache.maven.toolchain.Toolchain)5 File (java.io.File)4 IOException (java.io.IOException)4 JavaModuleDescriptor (org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor)4 Map (java.util.Map)3 LinkedHashMap (java.util.LinkedHashMap)2 ModuleNameSource (org.codehaus.plexus.languages.java.jpms.ResolvePathsResult.ModuleNameSource)2 HashMap (java.util.HashMap)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)1 JavaVersion (org.eclipse.xtext.util.JavaVersion)1