childDistMgmt = new DistributionManagement(); if ( childDistMgmt.getSite() == null ) if ( parentDistMgmt.getSite() != null ) childDistMgmt.setSite( site ); site.setId( parentDistMgmt.getSite().getId() ); site.setName( parentDistMgmt.getSite().getName() ); site.setUrl( parentDistMgmt.getSite().getUrl() ); if ( childDistMgmt.getRepository() == null ) if ( parentDistMgmt.getRepository() != null ) DeploymentRepository repository = copyDistributionRepository( parentDistMgmt.getRepository() ); childDistMgmt.setRepository( repository ); if ( childDistMgmt.getSnapshotRepository() == null ) if ( parentDistMgmt.getSnapshotRepository() != null ) copyDistributionRepository( parentDistMgmt.getSnapshotRepository() ); childDistMgmt.setSnapshotRepository( repository ); if ( StringUtils.isEmpty( childDistMgmt.getDownloadUrl() ) )
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 ) serializer.startTag( NAMESPACE, "downloadUrl" ).text( distributionManagement.getDownloadUrl() ).endTag( NAMESPACE, "downloadUrl" ); if ( distributionManagement.getRelocation() != null ) writeRelocation( (Relocation) distributionManagement.getRelocation(), "relocation", serializer ); if ( distributionManagement.getStatus() != null ) serializer.startTag( NAMESPACE, "status" ).text( distributionManagement.getStatus() ).endTag( NAMESPACE, "status" );
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" ) ); } } }
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" ) ); } } }
public static DistributionManagement cloneDistributionManagement( DistributionManagement src ) { if ( src == null ) { return null; } DistributionManagement result = new DistributionManagement(); result.setDownloadUrl( src.getDownloadUrl() ); result.setRelocation( cloneRelocation( src.getRelocation() ) ); result.setRepository( cloneDeploymentRepository( src.getRepository() ) ); result.setSite( cloneSite( src.getSite() ) ); result.setSnapshotRepository( cloneDeploymentRepository( src.getSnapshotRepository() ) ); result.setStatus( src.getStatus() ); return result; }
@Override public void validateEffectiveModel( Model m, ModelBuildingRequest request, ModelProblemCollector problems ) validateStringNotEmpty( "modelVersion", problems, Severity.ERROR, Version.BASE, m.getModelVersion(), m ); validateId( "groupId", problems, m.getGroupId(), m ); validateId( "artifactId", problems, m.getArtifactId(), m ); validateStringNotEmpty( "packaging", problems, Severity.ERROR, Version.BASE, m.getPackaging(), m ); if ( distMgmt != null ) if ( distMgmt.getStatus() != null ) validate20EffectiveRepository( problems, distMgmt.getRepository(), "distributionManagement.repository", request ); validate20EffectiveRepository( problems, distMgmt.getSnapshotRepository(), "distributionManagement.snapshotRepository", request );
model.setVersion( testVersion ); Build build = model.getBuild(); if ( build == null ) build.setOutputDirectory( buildDirectory+File.separatorChar+"classes" ); System.out.println("Using "+build.getDirectory()+" and "+build.getOutputDirectory()+" to build IT version of plugin"); model.setBuild( build ); DistributionManagement distMgmt = new DistributionManagement(); distMgmt.setRepository( deployRepo ); distMgmt.setSnapshotRepository( deployRepo ); model.addPluginRepository( localAsRemote ); Site site = new Site(); site.setId( "integration-test.output" ); site.setUrl( tmpUrl ); distMgmt.setSite( site ); model.setDistributionManagement( distMgmt );
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 ); }
private Model createStubModel( Artifact projectArtifact ) { getLogger().debug( "Using defaults for missing POM " + projectArtifact ); Model model = new Model(); model.setModelVersion( "4.0.0" ); model.setArtifactId( projectArtifact.getArtifactId() ); model.setGroupId( projectArtifact.getGroupId() ); model.setVersion( projectArtifact.getVersion() ); // TODO: not correct in some instances model.setPackaging( projectArtifact.getType() ); model.setDistributionManagement( new DistributionManagement() ); model.getDistributionManagement().setStatus( ArtifactStatus.GENERATED.toString() ); return model; }
Build dynamicBuild = model.getBuild(); model.setBuild( ModelUtils.cloneBuild( dynamicBuild ) ); mergeDeterministicBuildElements( model.getBuild(), dynamicBuild ); model.setBuild( dynamicBuild ); if ( dm != null ) ArtifactRepository repo = ProjectUtils.buildDeploymentArtifactRepository( dm.getRepository(), artifactRepositoryFactory, container ); project.setReleaseArtifactRepository( repo ); if ( dm.getSnapshotRepository() != null ) repo = ProjectUtils.buildDeploymentArtifactRepository( dm.getSnapshotRepository(), artifactRepositoryFactory, container ); project.setSnapshotArtifactRepository( repo );
Model model = mavenFacet.getModel(); if (model != null) { Build build = model.getBuild(); if (build == null) { build = new Build(); model.setBuild(build); Reporting reporting = model.getReporting(); if (reporting == null) { reporting = new Reporting(); distributionManagement = new DistributionManagement(); model.setDistributionManagement(distributionManagement); Site site = distributionManagement.getSite(); if (site == null) { site = new Site(); distributionManagement.setSite(site); String siteId = site.getId(); if (Strings.isNullOrBlank(siteId)) { site.setId("website"); changed = true;
private void injectDistributionManagement( Profile profile, Model model ) DistributionManagement mDistMgmt = model.getDistributionManagement(); model.setDistributionManagement( pDistMgmt ); if ( pDistMgmt.getRepository() != null ) mDistMgmt.setRepository( pDistMgmt.getRepository() ); if ( pDistMgmt.getSnapshotRepository() != null ) mDistMgmt.setSnapshotRepository( pDistMgmt.getSnapshotRepository() ); if ( StringUtils.isNotEmpty( pDistMgmt.getDownloadUrl() ) ) mDistMgmt.setDownloadUrl( pDistMgmt.getDownloadUrl() ); if ( pDistMgmt.getRelocation() != null ) mDistMgmt.setRelocation( pDistMgmt.getRelocation() ); if ( pDistMgmt.getSite() != null ) mDistMgmt.setSite( pDistMgmt.getSite() );
private boolean relocateIfNeeded(final MavenArtifact mart){ Model model = mart.getPom(); if (model.getDistributionManagement() != null) { final Relocation relocation = model.getDistributionManagement() .getRelocation(); if (relocation != null) { String newGroupId = relocation.getGroupId() == null ? mart.getCoordinates().getGroupId() : relocation.getGroupId(); String newArtifactId = relocation.getArtifactId() == null ? mart.getCoordinates().getArtifactId() : relocation.getArtifactId(); String newVersion = relocation.getVersion() == null ? mart.getCoordinates().getVersion() : relocation.getVersion(); Dependency dep = new Dependency(); dep.setArtifactId(newArtifactId); dep.setGroupId(newGroupId); dep.setVersion(newVersion); dep.setType(model.getPackaging()); model.getDependencies().clear(); model.addDependency(dep); model.setPackaging("pom"); return true; } } return false; }
@Override 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() ) ); } } }
void distribution( DistributionManagement distribution ){ if ( distribution != null ){ p.printStartBlock( "distribution" ); if ( distribution.getRepository() != null ){ printRepositories("repository", distribution.getRepository() ); } if ( distribution.getSnapshotRepository() != null ){ printRepositories("snapshot_repository", distribution.getSnapshotRepository() ); } if ( distribution.getSite() != null ){ Site site = distribution.getSite(); p.printWithOptions( "site", options( "id", site.getId(), "name", site.getName(), "url", site.getUrl() ) ); } p.printEndBlock(); p.println(); } }
@Override public void renderBody() List<String> modules = project.getModel().getModules(); moduleProject.setDistributionManagement( new DistributionManagement() ); moduleProject.getDistributionManagement().setSite( new Site() ); moduleProject.getDistributionManagement().getSite().setUrl( module );
DistributionManagement distributionManagement = new DistributionManagement(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) distributionManagement.setRepository( parseDeploymentRepository( parser, strict ) ); distributionManagement.setSnapshotRepository( parseDeploymentRepository( parser, strict ) ); distributionManagement.setSite( parseSite( parser, strict ) ); distributionManagement.setDownloadUrl( interpolatedTrimmed( parser.nextText(), "downloadUrl" ) ); distributionManagement.setRelocation( parseRelocation( parser, strict ) ); distributionManagement.setStatus( interpolatedTrimmed( parser.nextText(), "status" ) );
private static void setDistMgmntSiteUrl( Model model, String url ) { if ( model.getDistributionManagement() == null ) { model.setDistributionManagement( new DistributionManagement() ); } if ( model.getDistributionManagement().getSite() == null ) { model.getDistributionManagement().setSite( new Site() ); } model.getDistributionManagement().getSite().setUrl( url ); } }
private Relocation getRelocation( Model model ) { Relocation relocation = null; DistributionManagement distMgmt = model.getDistributionManagement(); if ( distMgmt != null ) { relocation = distMgmt.getRelocation(); } return relocation; }