Package org.apache.maven.plugin.lifecycle

Examples of org.apache.maven.plugin.lifecycle.LifecycleConfiguration


    {
        if ( lifecycleMappings == null )
        {
            LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader();
            InputStreamReader r = null;
            LifecycleConfiguration config;

            try
            {
                InputStream resourceAsStream = classRealm.getResourceAsStream( "/META-INF/maven/lifecycle.xml" );
                if ( resourceAsStream == null )
                {
                    throw new FileNotFoundException( "Unable to find /META-INF/maven/lifecycle.xml in the plugin" );
                }
                r = new InputStreamReader( resourceAsStream );
                config = reader.read( r, true );
            }
            finally
            {
                IOUtil.close( r );
            }

            Map map = new HashMap();

            for ( Iterator i = config.getLifecycles().iterator(); i.hasNext(); )
            {
                Lifecycle l = (Lifecycle) i.next();
                map.put( l.getId(), l );
            }
View Full Code Here


     * @return LifecycleConfiguration
     */
    private LifecycleConfiguration parseLifecycleConfiguration(String tagName, XmlPullParser parser, boolean strict)
        throws IOException, XmlPullParserException
    {
        LifecycleConfiguration lifecycleConfiguration = new LifecycleConfiguration();
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( parser.getName().equals( "lifecycle" ) )
                {
                    java.util.List lifecycles = lifecycleConfiguration.getLifecycles();
                    if ( lifecycles == null )
                    {
                        lifecycles = new java.util.ArrayList();
                        lifecycleConfiguration.setLifecycles( lifecycles );
                    }
                    lifecycles.add( parseLifecycle( "lifecycle", parser, strict ) );
                }
                else if ( !foundRoot && strict )
                {
View Full Code Here

    {
        if ( lifecycleMappings == null )
        {
            LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader();
            InputStreamReader r = null;
            LifecycleConfiguration config;

            try
            {
                InputStream resourceAsStream = classRealm.getResourceAsStream( "/META-INF/maven/lifecycle.xml" );
                if ( resourceAsStream == null )
                {
                    throw new FileNotFoundException( "Unable to find /META-INF/maven/lifecycle.xml in the plugin" );
                }
                r = new InputStreamReader( resourceAsStream );
                config = reader.read( r, true );
            }
            finally
            {
                IOUtil.close( r );
            }

            Map map = new HashMap();

            for ( Iterator i = config.getLifecycles().iterator(); i.hasNext(); )
            {
                Lifecycle l = (Lifecycle) i.next();
                map.put( l.getId(), l );
            }
View Full Code Here

    {
        if ( lifecycleMappings == null )
        {
            LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader();
            InputStreamReader r = null;
            LifecycleConfiguration config;

            try
            {
                InputStream resourceAsStream = classRealm.getResourceAsStream( "/META-INF/maven/lifecycle.xml" );
                if ( resourceAsStream == null )
                {
                    throw new FileNotFoundException( "Unable to find /META-INF/maven/lifecycle.xml in the plugin" );
                }
                r = new InputStreamReader( resourceAsStream );
                config = reader.read( r, true );
            }
            finally
            {
                IOUtil.close( r );
            }

            Map map = new HashMap();

            for ( Iterator i = config.getLifecycles().iterator(); i.hasNext(); )
            {
                Lifecycle l = (Lifecycle) i.next();
                map.put( l.getId(), l );
            }
View Full Code Here

     * @param parser
     */
    private LifecycleConfiguration parseLifecycleConfiguration(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        LifecycleConfiguration lifecycleConfiguration = new LifecycleConfiguration();
        lifecycleConfiguration.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( parser.getName().equals( "lifecycle" ) )
                {
                    java.util.List lifecycles = lifecycleConfiguration.getLifecycles();
                    if ( lifecycles == null )
                    {
                        lifecycles = new java.util.ArrayList();
                        lifecycleConfiguration.setLifecycles( lifecycles );
                    }
                    lifecycles.add( parseLifecycle( "lifecycle", parser, strict, encoding ) );
                }
                else
                {
View Full Code Here

     */
    private LifecycleConfiguration parseLifecycleConfiguration( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        LifecycleConfiguration lifecycleConfiguration = new LifecycleConfiguration();
        for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
        {
            String name = parser.getAttributeName( i );
            String value = parser.getAttributeValue( i );

            if ( name.indexOf( ':' ) >= 0 )
            {
                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
            }
            else if ( "xmlns".equals( name ) )
            {
                // ignore xmlns attribute in root class, which is a reserved attribute name
            }
            else
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( "lifecycle".equals( parser.getName() ) )
            {
                java.util.List lifecycles = lifecycleConfiguration.getLifecycles();
                if ( lifecycles == null )
                {
                    lifecycles = new java.util.ArrayList/*<Lifecycle>*/();
                    lifecycleConfiguration.setLifecycles( lifecycles );
                }
                lifecycles.add( parseLifecycle( parser, strict ) );
            }
            else
            {
View Full Code Here

            {
                if ( strict && ! "lifecycles".equals( parser.getName() ) )
                {
                    throw new XmlPullParserException( "Expected root element 'lifecycles' but found '" + parser.getName() + "'", parser, null );
                }
                LifecycleConfiguration lifecycleConfiguration = parseLifecycleConfiguration( parser, strict );
                lifecycleConfiguration.setModelEncoding( parser.getInputEncoding() );
                return lifecycleConfiguration;
            }
            eventType = parser.next();
        }
        throw new XmlPullParserException( "Expected root element 'lifecycles' but found no element at all: invalid XML document", parser, null );
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.lifecycle.LifecycleConfiguration

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.