Package org.apache.maven.bootstrap.model

Examples of org.apache.maven.bootstrap.model.ModelReader


    }

    public Model readModel( File file, boolean resolveTransitiveDependencies )
        throws ParserConfigurationException, SAXException, IOException
    {
        ModelReader reader = new ModelReader( resolver, resolveTransitiveDependencies );

        Model model = reader.parseModel( file, Collections.EMPTY_LIST );

        resolver.addBuiltArtifact( model.getGroupId(), model.getArtifactId(), "pom", file );

        String id = model.getGroupId() + ":" + model.getArtifactId();
        modelFileCache.put( id, file );
View Full Code Here


    }

    public Model readModel( File file, boolean resolveTransitiveDependencies )
        throws ParserConfigurationException, SAXException, IOException
    {
        ModelReader reader = new ModelReader( resolver, resolveTransitiveDependencies );

        Model model = reader.parseModel( file, Collections.EMPTY_LIST );

        resolver.addBuiltArtifact( model.getGroupId(), model.getArtifactId(), "pom", file );

        String id = model.getGroupId() + ":" + model.getArtifactId();
        modelFileCache.put( id, file );
View Full Code Here

   * @throws IOException                  the exception
   */
  public Model readModel(File file, boolean resolveTransitiveDependencies, boolean fullDownload)
      throws ParserConfigurationException, SAXException, IOException {

    ModelReader modelReader = new ModelReader(resolver, resolveTransitiveDependencies, fullDownload);

    Model model = modelReader.parseModel(file, Collections.EMPTY_LIST);

    resolver.addBuiltArtifact(model.getGroupId(), model.getArtifactId(), "pom", file);

    String id = model.getGroupId() + ":" + model.getArtifactId();

View Full Code Here

        Date fullStart = new Date();

        String basedir = System.getProperty( "user.dir" );

        File pom = new File( basedir, "pom.xml" );
        ModelReader reader = readModel( resolver, pom, true );
        File jar = buildProject( reader );

        if ( "install".equals( goal ) )
        {
            install( reader, pom, jar );
        }

        for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
        {
            Dependency dep = (Dependency) i.next();

            FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), jar.getParentFile() );
        }
View Full Code Here

    }

    private void cacheModels( File basedir, ArtifactResolver resolver )
        throws IOException, ParserConfigurationException, SAXException
    {
        ModelReader reader = readModel( resolver, new File( basedir, "pom.xml" ), false );

        for ( Iterator i = reader.getModules().iterator(); i.hasNext(); )
        {
            String module = (String) i.next();

            cacheModels( new File( basedir, module ), resolver );
        }
View Full Code Here

        System.setProperty( "basedir", basedir.getAbsolutePath() );

        File file = new File( basedir, "pom.xml" );

        ModelReader reader = readModel( resolver, file, true );

        String key = reader.getGroupId() + ":" + reader.getArtifactId() + ":" + reader.getPackaging();
        if ( inProgress.contains( key ) )
        {
            return;
        }

        if ( reader.getPackaging().equals( "pom" ) )
        {
            if ( buildModules )
            {
                for ( Iterator i = reader.getModules().iterator(); i.hasNext(); )
                {
                    String module = (String) i.next();

                    buildProject( new File( basedir, module ), true );
                }
View Full Code Here

            }

            Dependency dependency = plugin.asDependencyPom();
            resolver.downloadDependencies( Collections.singletonList( dependency ) );
            File artifactFile = resolver.getArtifactFile( dependency );
            ModelReader pluginReader = readModel( resolver, artifactFile, true );

            List dependencies = new ArrayList();
            for ( Iterator i = pluginReader.getDependencies().iterator(); i.hasNext(); )
            {
                Dependency d = (Dependency) i.next();
                if ( !d.getGroupId().equals( "org.apache.maven" ) )
                {
                    dependencies.add( d );
View Full Code Here

    }

    private ModelReader readModel( ArtifactResolver resolver, File file, boolean resolveTransitiveDependencies )
        throws ParserConfigurationException, SAXException, IOException
    {
        ModelReader reader = new ModelReader( resolver, resolveTransitiveDependencies );

        reader.parse( file );

        resolver.addBuiltArtifact( reader.getGroupId(), reader.getArtifactId(), "pom", file );

        String id = reader.getGroupId() + ":" + reader.getArtifactId();
        modelFileCache.put( id, file );

        modelCache.put( id, reader );

        return reader;
View Full Code Here

//        buildProject( basedir, "", resolver, false );
//        buildProject( basedir, "maven-artifact-manager", resolver );

        bootstrapper.buildProject( new File( basedir ), true );

        ModelReader mavenCoreModel = bootstrapper.getCachedModel( "org.apache.maven", "maven-core" );

        File installation = new File( basedir, "bootstrap/target/installation" );
        createInstallation( installation, mavenCoreModel );

        // TODO: should just need assembly from basedir
        runMaven( installation, new File( basedir ), new String[]{"clean", "install"} );

        File mavenCoreDir = mavenCoreModel.getProjectFile().getParentFile();
        runMaven( installation, mavenCoreDir, new String[]{"clean", "assembly:assembly"} );

        String finalName = "maven-" + mavenCoreModel.getVersion();
        File file = new File( mavenCoreDir, "target/" + finalName + "-bin.zip" );

        File mavenHome = new File( prefix, finalName );

        System.out.println( "Installing Maven in " + mavenHome );
View Full Code Here

TOP

Related Classes of org.apache.maven.bootstrap.model.ModelReader

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.