Java 类org.apache.maven.model.DistributionManagement 实例源码

项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateDistributionManagement
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateDistributionManagement( DistributionManagement value, String xmlTag, Counter counter,
                                             Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        updateDeploymentRepository( value.getRepository(), "repository", innerCount, root );
        updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root );
        updateSite( value.getSite(), "site", innerCount, root );
        findAndReplaceSimpleElement( innerCount, root, "downloadUrl", value.getDownloadUrl(), null );
        updateRelocation( value.getRelocation(), "relocation", innerCount, root );
        findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null );
    }
}
项目:spring-cloud-stream-app-maven-plugin    文件:MavenModelUtils.java   
public static void addDistributionManagement(Model pomModel) {
    DistributionManagement distributionManagement = new DistributionManagement();

    DeploymentRepository releaseRepo = new DeploymentRepository();
    releaseRepo.setId("repo.spring.io");
    releaseRepo.setName("Spring Release Repository");
    releaseRepo.setUrl("https://repo.spring.io/libs-release-local");
    distributionManagement.setRepository(releaseRepo);

    DeploymentRepository snapshotRepo = new DeploymentRepository();
    snapshotRepo.setId("repo.spring.io");
    snapshotRepo.setName("Spring Snapshot Repository");
    snapshotRepo.setUrl("https://repo.spring.io/libs-snapshot-local");
    distributionManagement.setSnapshotRepository(snapshotRepo);

    pomModel.setDistributionManagement(distributionManagement);
}
项目:spring-cloud-stream-app-maven-plugin    文件:MavenModelUtils.java   
public static void addProfiles(Model pomModel) {
    Profile profile = new Profile();
    profile.setId("milestone");
    DistributionManagement milestoneDistManagement = new DistributionManagement();

    DeploymentRepository milestoneRepo = new DeploymentRepository();
    milestoneRepo.setId("repo.spring.io");
    milestoneRepo.setName("Spring Milestone Repository");
    milestoneRepo.setUrl("https://repo.spring.io/libs-milestone-local");
    milestoneDistManagement.setRepository(milestoneRepo);
    profile.setDistributionManagement(milestoneDistManagement);
    List<Profile> profiles = new ArrayList<>();
    profiles.add(profile);

    profiles.add(centralProfile());

    pomModel.setProfiles(profiles);
}
项目:maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateDistributionManagement
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateDistributionManagement( DistributionManagement value, String xmlTag, Counter counter,
                                             Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        updateDeploymentRepository( value.getRepository(), "repository", innerCount, root );
        updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root );
        updateSite( value.getSite(), "site", innerCount, root );
        findAndReplaceSimpleElement( innerCount, root, "downloadUrl", value.getDownloadUrl(), null );
        updateRelocation( value.getRelocation(), "relocation", innerCount, root );
        findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null );
    }
}
项目:incubator-netbeans    文件:DependencyNode.java   
private Relocation getRelocation(org.netbeans.modules.maven.model.pom.Dependency d) {
    ProjectBuildingRequest dpbr = EmbedderFactory.getProjectEmbedder().createMavenExecutionRequest().getProjectBuildingRequest();
    dpbr.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
    dpbr.setProcessPlugins(false);
    dpbr.setResolveDependencies(false);
    ArrayList<ArtifactRepository> remoteRepos = new ArrayList<>();
    dpbr.setRemoteRepositories(remoteRepos);
    String groupId = d.getGroupId();
    String artifactId = d.getArtifactId();
    String version = d.getVersion();
    if(groupId != null && !"".equals(groupId.trim()) &&
       artifactId != null && !"".equals(artifactId.trim()) &&
       version != null && !"".equals(version.trim())) 
    {           
        MavenEmbedder embedder = EmbedderFactory.getProjectEmbedder();
        Artifact a = embedder.createProjectArtifact(groupId, artifactId, version);
        try {
            ProjectBuildingResult r = embedder.buildProject(a, dpbr);
            DistributionManagement dm = r.getProject().getDistributionManagement();
            return dm != null ? dm.getRelocation() : null;
        } catch (ProjectBuildingException ex) {
            // just log and hope for the best ...
            Logger.getLogger(DependencyNode.class.getName()).log(Level.INFO, version, ex);                
        }
    }
    return null;
}
项目:incubator-netbeans    文件:LocationAwareMavenXpp3Writer.java   
private void writeDistributionManagement(DistributionManagement distributionManagement, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();

    if (distributionManagement.getRepository() != null) {
        writeDeploymentRepository((DeploymentRepository) distributionManagement.getRepository(), "repository", serializer);
    }
    if (distributionManagement.getSnapshotRepository() != null) {
        writeDeploymentRepository((DeploymentRepository) distributionManagement.getSnapshotRepository(), "snapshotRepository", serializer);
    }
    if (distributionManagement.getSite() != null) {
        writeSite((Site) distributionManagement.getSite(), "site", serializer);
    }
    if (distributionManagement.getDownloadUrl() != null) {
        writeValue(serializer, "downloadUrl", distributionManagement.getDownloadUrl(), distributionManagement);
    }
    if (distributionManagement.getRelocation() != null) {
        writeRelocation((Relocation) distributionManagement.getRelocation(), "relocation", serializer);
    }
    if (distributionManagement.getStatus() != null) {
        writeValue(serializer, "status", distributionManagement.getStatus(), distributionManagement);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(distributionManagement, "", start, b.length());
}
项目:apache-archiva    文件:LegacyToDefaultConverter.java   
private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
                                 String newArtifactId, String newVersion, String message,
                                 ArtifactRepository repository, FileTransaction transaction )
    throws IOException
{
    Model pom = new Model();
    pom.setGroupId( groupId );
    pom.setArtifactId( artifactId );
    pom.setVersion( version );

    DistributionManagement dMngt = new DistributionManagement();

    Relocation relocation = new Relocation();
    relocation.setGroupId( newGroupId );
    relocation.setArtifactId( newArtifactId );
    relocation.setVersion( newVersion );
    if ( message != null && message.length() > 0 )
    {
        relocation.setMessage( message );
    }

    dMngt.setRelocation( relocation );

    pom.setDistributionManagement( dMngt );

    Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$
    File pomFile = new File( repository.getBasedir(), repository.pathOf( artifact ) );

    StringWriter strWriter = new StringWriter();
    MavenXpp3Writer pomWriter = new MavenXpp3Writer();
    pomWriter.write( strWriter, pom );

    transaction.createFile( strWriter.toString(), pomFile, digesters );
}
项目:xmvn    文件:DefaultModelProcessor.java   
private void visitDistributionManagement( ModelVisitor visitor, DistributionManagement distributionManagement )
{
    DeploymentRepository repository = distributionManagement.getRepository();
    if ( repository != null )
    {
        visitor.visitDistributionManagementRepository( repository );
        visitDistributionManagementRepository( visitor, repository );
        repository = visitor.replaceDistributionManagementRepository( repository );
        distributionManagement.setRepository( repository );
    }

    DeploymentRepository snapshotRepository = distributionManagement.getSnapshotRepository();
    if ( snapshotRepository != null )
    {
        visitor.visitDistributionManagementSnapshotRepository( snapshotRepository );
        visitDistributionManagementSnapshotRepository( visitor, snapshotRepository );
        snapshotRepository = visitor.replaceDistributionManagementSnapshotRepository( snapshotRepository );
        distributionManagement.setSnapshotRepository( snapshotRepository );
    }

    Site site = distributionManagement.getSite();
    if ( site != null )
    {
        visitor.visitDistributionManagementSite( site );
        site = visitor.replaceDistributionManagementSite( site );
        distributionManagement.setSite( site );
    }

    Relocation relocation = distributionManagement.getRelocation();
    if ( relocation != null )
    {
        visitor.visitDistributionManagementRelocation( relocation );
        relocation = visitor.replaceDistributionManagementRelocation( relocation );
        distributionManagement.setRelocation( relocation );
    }
}
项目:xmvn    文件:DefaultModelProcessor.java   
private void visitProfileDistributionManagement( ModelVisitor visitor,
                                                 DistributionManagement distributionManagement )
{
    DeploymentRepository repository = distributionManagement.getRepository();
    if ( repository != null )
    {
        visitor.visitProfileDistributionManagementRepository( repository );
        visitProfileDistributionManagementRepository( visitor, repository );
        repository = visitor.replaceProfileDistributionManagementRepository( repository );
        distributionManagement.setRepository( repository );
    }

    DeploymentRepository snapshotRepository = distributionManagement.getSnapshotRepository();
    if ( snapshotRepository != null )
    {
        visitor.visitProfileDistributionManagementSnapshotRepository( snapshotRepository );
        visitProfileDistributionManagementSnapshotRepository( visitor, snapshotRepository );
        snapshotRepository = visitor.replaceProfileDistributionManagementSnapshotRepository( snapshotRepository );
        distributionManagement.setSnapshotRepository( snapshotRepository );
    }

    Site site = distributionManagement.getSite();
    if ( site != null )
    {
        visitor.visitProfileDistributionManagementSite( site );
        site = visitor.replaceProfileDistributionManagementSite( site );
        distributionManagement.setSite( site );
    }

    Relocation relocation = distributionManagement.getRelocation();
    if ( relocation != null )
    {
        visitor.visitProfileDistributionManagementRelocation( relocation );
        relocation = visitor.replaceProfileDistributionManagementRelocation( relocation );
        distributionManagement.setRelocation( relocation );
    }
}
项目:archiva    文件:LegacyToDefaultConverter.java   
private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
                                 String newArtifactId, String newVersion, String message,
                                 ArtifactRepository repository, FileTransaction transaction )
    throws IOException
{
    Model pom = new Model();
    pom.setGroupId( groupId );
    pom.setArtifactId( artifactId );
    pom.setVersion( version );

    DistributionManagement dMngt = new DistributionManagement();

    Relocation relocation = new Relocation();
    relocation.setGroupId( newGroupId );
    relocation.setArtifactId( newArtifactId );
    relocation.setVersion( newVersion );
    if ( message != null && message.length() > 0 )
    {
        relocation.setMessage( message );
    }

    dMngt.setRelocation( relocation );

    pom.setDistributionManagement( dMngt );

    Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$
    Path pomFile = Paths.get( repository.getBasedir(), repository.pathOf( artifact ) );

    StringWriter strWriter = new StringWriter();
    MavenXpp3Writer pomWriter = new MavenXpp3Writer();
    pomWriter.write( strWriter, pom );

    transaction.createFile( strWriter.toString(), pomFile, digesters );
}
项目:git-rollback-maven-plugin    文件:GitReleaseRollback.java   
private ArtifactRepository getReleaseRepo() {
    DistributionManagement distributionManagement = project.getDistributionManagement();
       if ( distributionManagement != null && distributionManagement.getRepository() != null ) {            
        try {
            ArtifactRepository repo = repositorySystem.buildArtifactRepository(distributionManagement.getRepository());

               repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
               repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
                                                      Arrays.asList( repo ) );
               return repo;
        } catch (InvalidRepositoryException e) {}
       }
       return null;
}
项目:oceano    文件:DefaultArtifactDescriptorReader.java   
private Relocation getRelocation( Model model )
{
    Relocation relocation = null;
    DistributionManagement distMngt = model.getDistributionManagement();
    if ( distMngt != null )
    {
        relocation = distMngt.getRelocation();
    }
    return relocation;
}
项目:oceano    文件:ModelMerger.java   
protected void mergeDistributionManagement( DistributionManagement target, DistributionManagement source,
                                            boolean sourceDominant, Map<Object, Object> context )
{
    mergeDistributionManagement_Repository( target, source, sourceDominant, context );
    mergeDistributionManagement_SnapshotRepository( target, source, sourceDominant, context );
    mergeDistributionManagement_Site( target, source, sourceDominant, context );
    mergeDistributionManagement_Status( target, source, sourceDominant, context );
    mergeDistributionManagement_DownloadUrl( target, source, sourceDominant, context );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeDistributionManagement_Status( DistributionManagement target, DistributionManagement source,
                                                   boolean sourceDominant, Map<Object, Object> context )
{
    String src = source.getStatus();
    if ( src != null )
    {
        if ( sourceDominant || target.getStatus() == null )
        {
            target.setStatus( src );
            target.setLocation( "status", source.getLocation( "status" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeDistributionManagement_DownloadUrl( DistributionManagement target,
                                                        DistributionManagement source, boolean sourceDominant,
                                                        Map<Object, Object> context )
{
    String src = source.getDownloadUrl();
    if ( src != null )
    {
        if ( sourceDominant || target.getDownloadUrl() == null )
        {
            target.setDownloadUrl( src );
            target.setLocation( "downloadUrl", source.getLocation( "downloadUrl" ) );
        }
    }
}
项目:oceano    文件:DefaultModelUrlNormalizer.java   
public void normalize( Model model, ModelBuildingRequest request )
{
    if ( model == null )
    {
        return;
    }

    model.setUrl( normalize( model.getUrl() ) );

    Scm scm = model.getScm();
    if ( scm != null )
    {
        scm.setUrl( normalize( scm.getUrl() ) );
        scm.setConnection( normalize( scm.getConnection() ) );
        scm.setDeveloperConnection( normalize( scm.getDeveloperConnection() ) );
    }

    DistributionManagement dist = model.getDistributionManagement();
    if ( dist != null )
    {
        Site site = dist.getSite();
        if ( site != null )
        {
            site.setUrl( normalize( site.getUrl() ) );
        }
    }
}
项目:dtgov    文件:MavenRepoUtil.java   
public MavenRepository getMavenReleaseRepo(
        String repoUrl, boolean isReleaseEnabled, boolean isSnapshotEnabled,
        InputStream pomStream
        ) throws Exception {

    //PlexusContainer container = new DefaultPlexusContainer();
    //ArtifactRepositoryFactory artifactRepoFactory = container.lookup(ArtifactRepositoryFactory.class);

    DeploymentRepository releaseToRepo = new DeploymentRepository();
    releaseToRepo.setId("central"); //$NON-NLS-1$
    releaseToRepo.setLayout("default"); //$NON-NLS-1$
    releaseToRepo.setUrl(repoUrl);
    RepositoryPolicy pol = new RepositoryPolicy();
    pol.setEnabled(isReleaseEnabled);
    pol.setUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
    pol.setChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
    releaseToRepo.setReleases(pol);
    RepositoryPolicy pol2 = new RepositoryPolicy();
    pol2.setEnabled(isSnapshotEnabled);
    pol2.setUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
    pol2.setChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
    releaseToRepo.setSnapshots(pol2);

    MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);

    DistributionManagement dm = new DistributionManagement();
    dm.setSnapshotRepository(releaseToRepo);
    mavenProject.setDistributionManagement(dm);

    //List<ArtifactRepository> remoteArtifactRepositories = new ArrayList<ArtifactRepository>();
    //remoteArtifactRepositories.add(releaseToRepo);
    //mavenProject.setRemoteArtifactRepositories(remoteArtifactRepositories);

    //org.apache.maven.artifact.repository.Authentication authentication
    //  = new org.apache.maven.artifact.repository.Authentication("user","pw");
    //mavenRepo.setAuthentication(authentication);

    MavenRepository repo = getMavenRepository(mavenProject);
    return repo;
}
项目:Pogamut3    文件:DependencyProjectStub.java   
public DistributionManagement getDistributionManagement()
{
    return null;
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public DistributionManagement replaceDistributionManagement( DistributionManagement distributionManagement )
{
    return distributionManagement;
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public DistributionManagement replaceProfileDistributionManagement( DistributionManagement distributionManagement )
{
    return distributionManagement;
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public void visitDistributionManagement( DistributionManagement distributionManagement )
{
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public void visitProfileDistributionManagement( DistributionManagement distributionManagement )
{
}
项目:flatten-maven-plugin    文件:PomProperty.java   
@Override
public DistributionManagement get( Model model )
{
    return model.getDistributionManagement();
}
项目:flatten-maven-plugin    文件:PomProperty.java   
@Override
public void set( Model model, DistributionManagement value )
{
    model.setDistributionManagement( value );
}
项目:gitflow-helper-maven-plugin    文件:RetargetDeployMojo.java   
@Override
protected void execute(final GitBranchType type, final String gitBranch, final String branchPattern) throws MojoExecutionException, MojoFailureException {
    if (project.getDistributionManagement() == null) {
        project.setDistributionManagement(new DistributionManagement());
    }

    switch (type) {
        case SUPPORT:
        case MASTER: {
            getLog().info("Setting release artifact repository to: [" + releaseDeploymentRepository + "]");
            project.setSnapshotArtifactRepository(null);
            project.setReleaseArtifactRepository(getDeploymentRepository(releaseDeploymentRepository));
            break;
        }
        case RELEASE: {
            getLog().info("Setting release artifact repository to: [" + stageDeploymentRepository + "]");
            project.setSnapshotArtifactRepository(null);
            project.setReleaseArtifactRepository(getDeploymentRepository(stageDeploymentRepository));
            break;
        }
        case HOTFIX: {
            getLog().info("Setting release artifact repository to: [" + stageDeploymentRepository + "]");
            project.setSnapshotArtifactRepository(null);
            project.setReleaseArtifactRepository(getDeploymentRepository(stageDeploymentRepository));
            break;
        }
        case DEVELOPMENT: {
            getLog().info("Setting snapshot artifact repository to: [" + snapshotDeploymentRepository + "]");
            project.setSnapshotArtifactRepository(getDeploymentRepository(snapshotDeploymentRepository));
            project.setReleaseArtifactRepository(null);
            break;
        }
        default: {
            getLog().info("Un-Setting artifact repositories.");
            project.setSnapshotArtifactRepository(null);
            project.setReleaseArtifactRepository(null);
            project.getProperties().put("maven.deploy.skip", "true");
            getLog().info("Setting maven.deploy.skip = 'true'");
            break;
        }
    }
}
项目:oceano    文件:MavenProject.java   
public void setDistributionManagement( DistributionManagement distributionManagement )
{
    getModel().setDistributionManagement( distributionManagement );
}
项目:oceano    文件:MavenProject.java   
public DistributionManagement getDistributionManagement()
{
    return getModel().getDistributionManagement();
}
项目:jwrapper-maven-plugin    文件:MavenProjectDelegate.java   
@Override
public void setDistributionManagement(
        final DistributionManagement management) {
    getDelegate().setDistributionManagement(management);
}
项目:jwrapper-maven-plugin    文件:MavenProjectDelegate.java   
@Override
public DistributionManagement getDistributionManagement() {
    return getDelegate().getDistributionManagement();
}
项目:Pogamut3    文件:DependencyProjectStub.java   
public void setDistributionManagement( DistributionManagement distributionManagement )
{

}
项目:xmvn    文件:ModelVisitor.java   
DistributionManagement replaceDistributionManagement( DistributionManagement distributionManagement );
项目:xmvn    文件:ModelVisitor.java   
DistributionManagement replaceProfileDistributionManagement( DistributionManagement distributionManagement );
项目:xmvn    文件:ModelVisitor.java   
void visitDistributionManagement( DistributionManagement distributionManagement );
项目:xmvn    文件:ModelVisitor.java   
void visitProfileDistributionManagement( DistributionManagement distributionManagement );