src/main/java/org/bsc/maven/plugin/processor/AbstractAnnotationProcessorMojo.java
private Toolchain getToolchain(final Map<String, String> jdkToolchain)
    {
        Toolchain tc = null;
        
        if ( jdkToolchain != null && !jdkToolchain.isEmpty())
        {
            // Maven 3.3.1 has plugin execution scoped Toolchain Support
            try
            {
                final Method getToolchainsMethod =
                    toolchainManager.getClass().getMethod(  "getToolchains", 
                                                            MavenSession.class, 
                                                            String.class,
                                                            Map.class );

                @SuppressWarnings( "unchecked" )
                final List<Toolchain> tcs =
                    (List<Toolchain>) getToolchainsMethod.invoke(   toolchainManager, 
                                                                    session, 
                                                                    "jdk",
                                                                    jdkToolchain );

                if ( tcs != null && tcs.size() > 0 )
                {
                    tc = tcs.get( 0 );
                }
            }
            catch ( Exception e )
            {
                // ignore
            }
        }
        
        if ( tc == null )
        {
            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
        }
        
        return tc;
    }
private Toolchain getToolchain(final Map<String, String> jdkToolchain)
    {
        Toolchain tc = null;
        
        if ( jdkToolchain != null && !jdkToolchain.isEmpty())
        {
            // Maven 3.3.1 has plugin execution scoped Toolchain Support
            try
            {
                final Method getToolchainsMethod =
                    toolchainManager.getClass().getMethod(  "getToolchains", 
                                                            MavenSession.class, 
                                                            String.class,
                                                            Map.class );

                @SuppressWarnings( "unchecked" )
                final List<Toolchain> tcs =
                    (List<Toolchain>) getToolchainsMethod.invoke(   toolchainManager, 
                                                                    session, 
                                                                    "jdk",
                                                                    jdkToolchain );

                if ( tcs != null && tcs.size() > 0 )
                {
                    tc = tcs.get( 0 );
                }
            }
            catch ( Exception e )
            {
                // ignore
            }
        }
        
        if ( tc == null )
        {
            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
        }
        
        return tc;
    }
private Toolchain getToolchain ( final Map < String , String > jdkToolchain ) { Toolchain tc = null ; if ( jdkToolchain != null && ! jdkToolchain . isEmpty ( ) ) { // Maven 3.3.1 has plugin execution scoped Toolchain Support try { final Method getToolchainsMethod = toolchainManager . getClass ( ) . getMethod ( "getToolchains" , MavenSession . class , String . class , Map . class ) ; @ SuppressWarnings ( "unchecked" ) final List < Toolchain > tcs = ( List < Toolchain > ) getToolchainsMethod . invoke ( toolchainManager , session , "jdk" , jdkToolchain ) ; if ( tcs != null && tcs . size ( ) > 0 ) { tc = tcs . get ( 0 ) ; } } catch ( Exception e ) { // ignore } } if ( tc == null ) { tc = toolchainManager . getToolchainFromBuildContext ( "jdk" , session ) ; } return tc ; }
TODO remove the part with ToolchainManager lookup once we depend on
3.0.9 (have it as prerequisite). Define as regular component field then.

@param jdkToolchain
TODO remove the part with ToolchainManager lookup once we depend on 3 . 0 . 9 ( have it as prerequisite ) . Define as regular component field then .