Package org.apache.maven.toolchain

Examples of org.apache.maven.toolchain.MisconfiguredToolchainException


        DefaultJavaToolChain jtc = new DefaultJavaToolChain( model, logger );
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME );
        if ( javahome == null )
        {
            throw new MisconfiguredToolchainException( "Java toolchain without the "
                + DefaultJavaToolChain.KEY_JAVAHOME + " configuration element." );
        }
        File normal = new File( FileUtils.normalize( javahome.getValue() ) );
        if ( normal.exists() )
        {
            jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
        }
        else
        {
            throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at "
                + normal.getAbsolutePath() );
        }

        //now populate the provides section.
        //TODO possibly move at least parts to a utility method or abstract implementation.
        dom = (Xpp3Dom) model.getProvides();
        Xpp3Dom[] provides = dom.getChildren();
        for ( Xpp3Dom provide : provides )
        {
            String key = provide.getName();
            String value = provide.getValue();
            if ( value == null )
            {
                throw new MisconfiguredToolchainException(
                    "Provides token '" + key + "' doesn't have any value configured." );
            }
            if ( "version".equals( key ) )
            {
                jtc.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher( value ) );
View Full Code Here


        DefaultJavaToolChain jtc = new DefaultJavaToolChain( model, logger );
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME );
        if ( javahome == null )
        {
            throw new MisconfiguredToolchainException( "Java toolchain without the "
                + DefaultJavaToolChain.KEY_JAVAHOME + " configuration element." );
        }
        File normal = new File( FileUtils.normalize( javahome.getValue() ) );
        if ( normal.exists() )
        {
            jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
        }
        else
        {
            throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at "
                + normal.getAbsolutePath() );
        }

        //now populate the provides section.
        //TODO possibly move at least parts to a utility method or abstract implementation.
        dom = (Xpp3Dom) model.getProvides();
        Xpp3Dom[] provides = dom.getChildren();
        for ( int i = 0; i < provides.length; i++ )
        {
            String key = provides[i].getName();
            String value = provides[i].getValue();
            if ( value == null )
            {
                throw new MisconfiguredToolchainException( "Provides token '" + key + "' doesn't have any value configured." );
            }
            if ( "version".equals( key ) )
            {
                jtc.addProvideToken( key,
                    RequirementMatcherFactory.createVersionMatcher( value ) );
View Full Code Here

        DefaultJavaToolChain jtc = new DefaultJavaToolChain( model, logger );
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME );
        if ( javahome == null )
        {
            throw new MisconfiguredToolchainException( "Java toolchain without the "
                + DefaultJavaToolChain.KEY_JAVAHOME + " configuration element." );
        }
        File normal = new File( FileUtils.normalize( javahome.getValue() ) );
        if ( normal.exists() )
        {
            jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
        }
        else
        {
            throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at "
                + normal.getAbsolutePath() );
        }

        //now populate the provides section.
        //TODO possibly move at least parts to a utility method or abstract implementation.
        dom = (Xpp3Dom) model.getProvides();
        Xpp3Dom[] provides = dom.getChildren();
        for ( int i = 0; i < provides.length; i++ )
        {
            String key = provides[i].getName();
            String value = provides[i].getValue();
            if ( value == null )
            {
                throw new MisconfiguredToolchainException( "Provides token '" + key + "' doesn't have any value configured." );
            }
            if ( "version".equals( key ) )
            {
                jtc.addProvideToken( key,
                    RequirementMatcherFactory.createVersionMatcher( value ) );
View Full Code Here

            String key = (String) provide.getKey();
            String value = (String) provide.getValue();

            if ( value == null )
            {
                throw new MisconfiguredToolchainException(
                    "Provides token '" + key + "' doesn't have any value configured." );
            }

            RequirementMatcher matcher;
            if ( "version".equals( key ) )
            {
                matcher = RequirementMatcherFactory.createVersionMatcher( value );
            }
            else
            {
                matcher = RequirementMatcherFactory.createExactMatcher( value );
            }

            jtc.addProvideToken( key, matcher );
        }

        // populate the configuration section
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom.getChild( JavaToolchainImpl.KEY_JAVAHOME );
        if ( javahome == null )
        {
            throw new MisconfiguredToolchainException( "Java toolchain without the "
                + JavaToolchainImpl.KEY_JAVAHOME + " configuration element." );
        }
        File normal = new File( FileUtils.normalize( javahome.getValue() ) );
        if ( normal.exists() )
        {
            jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
        }
        else
        {
            throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at "
                + normal.getAbsolutePath() );
        }

        return jtc;
    }
View Full Code Here

        DefaultJavaToolChain jtc = new DefaultJavaToolChain( model , logger);
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom.getChild( DefaultJavaToolChain.KEY_JAVAHOME );
        if ( javahome == null )
        {
            throw new MisconfiguredToolchainException( "Java toolchain without the " + DefaultJavaToolChain.KEY_JAVAHOME + " configuration element." );
        }
        File normal = new File( FileUtils.normalize( javahome.getValue() ) );
        if ( normal.exists() )
        {
            jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
        }
        else
        {
            throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at " + normal.getAbsolutePath(  ) );
        }

        //now populate the provides section.
        //TODO possibly move at least parts to a utility method or abstract implementation.
        dom = (Xpp3Dom) model.getProvides();
        Xpp3Dom[] provides = dom.getChildren();
        for ( int i = 0; i < provides.length; i++ )
        {
            String key = provides[i].getName();
            String value = provides[i].getValue();
            if ( value == null )
            {
                throw new MisconfiguredToolchainException( "Provides token '" + key + "' doesn't have any value configured." );
            }
            if ( "version".equals( key ) )
            {
                jtc.addProvideToken( key,
                    RequirementMatcherFactory.createVersionMatcher( value ) );
View Full Code Here

        {
            String key = (String) provide.getKey();
            String value = (String) provide.getValue();
            if ( value == null )
            {
                throw new MisconfiguredToolchainException(
                    "Provides token '" + key + "' doesn't have any value configured." );
            }

            if ( "version".equals( key ) )
            {
                customToolchain.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher( value ) );
            }
            else
            {
                customToolchain.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) );
            }
        }

        // populate the configuration section
        Properties configuration = getModelProperties( model, "configuration" );

        String toolHome = configuration.getProperty( DefaultCustomToolchain.KEY_TOOLHOME );
        if ( toolHome == null )
        {
            throw new MisconfiguredToolchainException( "Custom toolchain without the "
                + DefaultCustomToolchain.KEY_TOOLHOME + " configuration element." );
        }

        toolHome = FileUtils.normalize( toolHome );
        customToolchain.setToolHome( toolHome );

        if ( !new File( toolHome ).exists() )
        {
            throw new MisconfiguredToolchainException( "Non-existing tool home configuration at "
                                                        + new File( toolHome ).getAbsolutePath() );
        }

        return customToolchain;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.toolchain.MisconfiguredToolchainException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.