Package org.apache.maven.project

Examples of org.apache.maven.project.MavenProject


        suppress(constructor(DescriptorImpl.class));
       
        this.module = mock(MavenModule.class);
        basicMocking(this.module);
       
        this.project = new MavenProject();
        project.setGroupId("test");
        project.setArtifactId("testmodule");
        project.setVersion("2.0-SNAPSHOT");
        project.setPackaging("jar");
       
View Full Code Here


        plugin.setGroupId(pluginModule.getModuleName().groupId);
        plugin.setArtifactId(pluginModule.getModuleName().artifactId);
        plugin.setVersion(pluginModule.getVersion());
        build.setPlugins(Collections.singletonList(plugin));
       
        MavenProject project = new MavenProject();
        project.setGroupId(module.getModuleName().groupId);
        project.setArtifactId(module.getModuleName().artifactId);
        project.setVersion(module.getVersion());
        project.setPackaging("jar");
        project.setBuild(build);
       
        module.reconfigure(new PomInfo(project, null, "relPath"));
    }
View Full Code Here

    private static MavenModule createPluginProject() {
        MavenModule pluginModule = mock(MavenModule.class);
        basicMocking(pluginModule);
       
        MavenProject proj = new MavenProject();
        proj.setGroupId("test");
        proj.setArtifactId("pluginmodule");
        proj.setVersion("1.0-SNAPSHOT");
        proj.setPackaging("maven-plugin");
        PomInfo info = new PomInfo(proj, null, "relPath");
        pluginModule.reconfigure(info);
        pluginModule.doSetName("test$pluginmodule");
       
        return pluginModule;
View Full Code Here

                    String relativePath = rel;
                    if ( relativePath.length() > 0 )
                        relativePath += '/';
                    relativePath += modulePath;

                    MavenProject child = embedder.readProject( moduleFile );
                    resolveModules( embedder, child, relativePath, relativePathInfo, listener, nonRecursive );
                    modules.add( child );
                }
            }
        }
View Full Code Here

    private WagonManager m_wagonManager;


    public void execute() throws MojoExecutionException
    {
        MavenProject project = getProject();

        if ( !supportedProjectTypes.contains( project.getPackaging() ) )
        {
            getLog().info( "Ignoring packaging type " + project.getPackaging() );
            return;
        }
        else if ( "NONE".equalsIgnoreCase( obrRepository ) )
        {
            getLog().info( "OBR update disabled (enable with -DobrRepository)" );
            return;
        }

        URI tempURI = ObrUtils.findRepositoryXml( "", obrRepository );
        String repositoryName = new File( tempURI.getPath() ).getName();

        Log log = getLog();
        ObrUpdate update;

        RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
        remoteFile.connect( repositoryId, url );

        // ======== LOCK REMOTE OBR ========
        log.info( "LOCK " + remoteFile + '/' + repositoryName );
        remoteFile.lockFile( repositoryName, ignoreLock );
        File downloadedRepositoryXml = null;

        try
        {
            // ======== DOWNLOAD REMOTE OBR ========
            log.info( "Downloading " + repositoryName );
            downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" );

            String mavenRepository = localRepository.getBasedir();

            URI repositoryXml = downloadedRepositoryXml.toURI();
            URI obrXmlFile = ObrUtils.toFileURI( obrXml );
            URI bundleJar;

            if ( null == file )
            {
                bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact() );
            }
            else
            {
                bundleJar = file.toURI();
            }

            URI remoteBundleURI = null;
            if ( null != bundleUrl )
            {
                remoteBundleURI = URI.create( bundleUrl );
            }
            else if ( null != file )
            {
                remoteBundleURI = URI.create( localRepository.pathOf( project.getArtifact() ) );
            }

            Config userConfig = new Config();
            userConfig.setRemoteBundle( remoteBundleURI );
            userConfig.setPathRelative( true );
View Full Code Here

        try
        {
            reader = new FileReader( pomFile );
            MavenXpp3Reader modelReader = new MavenXpp3Reader();
            return new MavenProject( modelReader.read( reader ) );
        }
        catch ( FileNotFoundException e )
        {
            throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e );
        }
View Full Code Here

        model.setGroupId( groupId );
        model.setArtifactId( artifactId );
        model.setVersion( version );
        model.setPackaging( packaging );

        return new MavenProject( model );
    }
View Full Code Here

                getLog().debug(
                    "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth );
                continue;
            }

            MavenProject childProject;
            try
            {
                childProject = m_mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
                    localRepository, true );
                if ( childProject.getDependencyArtifacts() == null )
                {
                    childProject.setDependencyArtifacts( childProject.createArtifacts( m_factory, null, null ) );
                }
            }
            catch ( InvalidDependencyVersionException e )
            {
                throw new MojoExecutionException( "Invalid dependency version for artifact " + artifact );
            }
            catch ( ProjectBuildingException e )
            {
                throw new MojoExecutionException( "Unable to build project object for artifact " + artifact, e );
            }

            childProject.setArtifact( artifact );
            getLog().debug( "Child project artifact location: " + childProject.getArtifact().getFile() );

            if ( ( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
                || ( Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) ) )
            {
                BundleInfo subBundleInfo = bundleAll( childProject, maxDepth - 1 );
                if ( subBundleInfo != null )
                {
                    bundleInfo.merge( subBundleInfo );
                }
            }
            else
            {
                getLog().debug(
                    "Not processing due to scope (" + childProject.getArtifact().getScope() + "): "
                        + childProject.getArtifact() );
            }
        }

        return bundleRoot( project, bundleInfo );
    }
View Full Code Here

    private ArtifactRepository localRepository;


    public void execute() throws MojoExecutionException
    {
        MavenProject project = getProject();

        if ( !supportedProjectTypes.contains( project.getPackaging() ) )
        {
            getLog().info( "Ignoring packaging type " + project.getPackaging() );
            return;
        }
        else if ( "NONE".equalsIgnoreCase( obrRepository ) )
        {
            getLog().info( "OBR update disabled (enable with -DobrRepository)" );
            return;
        }

        Log log = getLog();
        ObrUpdate update;

        String mavenRepository = localRepository.getBasedir();

        URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
        URI obrXmlFile = ObrUtils.toFileURI( obrXml );
        URI bundleJar;

        if ( null == file )
        {
            bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact() );
        }
        else
        {
            bundleJar = file.toURI();
        }
View Full Code Here

     * @return project based on command-line settings, with bundle attached
     * @throws MojoExecutionException
     */
    public MavenProject getProject() throws MojoExecutionException
    {
        final MavenProject project;
        if ( pomFile != null && pomFile.exists() )
        {
            project = PomHelper.readPom( pomFile );

            groupId = project.getGroupId();
            artifactId = project.getArtifactId();
            version = project.getVersion();
            packaging = project.getPackaging();
        }
        else
        {
            project = PomHelper.buildPom( groupId, artifactId, version, packaging );
        }

        if ( groupId == null || artifactId == null || version == null || packaging == null )
        {
            throw new MojoExecutionException( "Missing group, artifact, version, or packaging information" );
        }

        Artifact bundle = m_factory.createArtifactWithClassifier( groupId, artifactId, version, packaging, classifier );
        project.setArtifact( bundle );

        return project;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.project.MavenProject

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.