本文整理汇总了Java中org.apache.maven.model.Relocation类的典型用法代码示例。如果您正苦于以下问题:Java Relocation类的具体用法?Java Relocation怎么用?Java Relocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Relocation类属于org.apache.maven.model包,在下文中一共展示了Relocation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
private void writeRelocation(Relocation relocation, String tagName, XmlSerializer serializer)
throws java.io.IOException {
serializer.startTag(NAMESPACE, tagName);
flush(serializer);
StringBuffer b = b(serializer);
int start = b.length();
if (relocation.getGroupId() != null) {
writeValue(serializer, "groupId", relocation.getGroupId(), relocation);
}
if (relocation.getArtifactId() != null) {
writeValue(serializer, "artifactId", relocation.getArtifactId(), relocation);
}
if (relocation.getVersion() != null) {
writeValue(serializer, "version", relocation.getVersion(), relocation);
}
if (relocation.getMessage() != null) {
writeValue(serializer, "message", relocation.getMessage(), relocation);
}
serializer.endTag(NAMESPACE, tagName).flush();
logLocation(relocation, "", start, b.length());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LocationAwareMavenXpp3Writer.java
示例2: getRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:DependencyNode.java
示例3: writeDistributionManagement
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:LocationAwareMavenXpp3Writer.java
示例4: updateRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
/**
* Method updateRelocation
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updateRelocation( Relocation 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 );
findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null );
}
}
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:22,代码来源:MavenJDOMWriter.java
示例5: writeRelocationPom
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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 );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:35,代码来源:LegacyToDefaultConverter.java
示例6: visitDistributionManagement
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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 );
}
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:37,代码来源:DefaultModelProcessor.java
示例7: visitProfileDistributionManagement
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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 );
}
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:38,代码来源:DefaultModelProcessor.java
示例8: writeRelocationPom
import org.apache.maven.model.Relocation; //导入依赖的package包/类
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 );
}
开发者ID:apache,项目名称:archiva,代码行数:35,代码来源:LegacyToDefaultConverter.java
示例9: getRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
private Relocation getRelocation( Model model )
{
Relocation relocation = null;
DistributionManagement distMngt = model.getDistributionManagement();
if ( distMngt != null )
{
relocation = distMngt.getRelocation();
}
return relocation;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:11,代码来源:DefaultArtifactDescriptorReader.java
示例10: mergeRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
protected void mergeRelocation( Relocation target, Relocation source, boolean sourceDominant,
Map<Object, Object> context )
{
mergeRelocation_GroupId( target, source, sourceDominant, context );
mergeRelocation_ArtifactId( target, source, sourceDominant, context );
mergeRelocation_Version( target, source, sourceDominant, context );
mergeRelocation_Message( target, source, sourceDominant, context );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:ModelMerger.java
示例11: mergeRelocation_GroupId
import org.apache.maven.model.Relocation; //导入依赖的package包/类
protected void mergeRelocation_GroupId( Relocation target, Relocation source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getGroupId();
if ( src != null )
{
if ( sourceDominant || target.getGroupId() == null )
{
target.setGroupId( src );
target.setLocation( "groupId", source.getLocation( "groupId" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例12: mergeRelocation_ArtifactId
import org.apache.maven.model.Relocation; //导入依赖的package包/类
protected void mergeRelocation_ArtifactId( Relocation target, Relocation source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getArtifactId();
if ( src != null )
{
if ( sourceDominant || target.getArtifactId() == null )
{
target.setArtifactId( src );
target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例13: mergeRelocation_Version
import org.apache.maven.model.Relocation; //导入依赖的package包/类
protected void mergeRelocation_Version( Relocation target, Relocation source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getVersion();
if ( src != null )
{
if ( sourceDominant || target.getVersion() == null )
{
target.setVersion( src );
target.setLocation( "version", source.getLocation( "version" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例14: mergeRelocation_Message
import org.apache.maven.model.Relocation; //导入依赖的package包/类
protected void mergeRelocation_Message( Relocation target, Relocation source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getMessage();
if ( src != null )
{
if ( sourceDominant || target.getMessage() == null )
{
target.setMessage( src );
target.setLocation( "message", source.getLocation( "message" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例15: runModifyExclusions
import org.apache.maven.model.Relocation; //导入依赖的package包/类
private void runModifyExclusions(final Artifact art, final Collection<org.apache.maven.shared.dependency.tree.DependencyNode> nds) {
ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
@Override
public void performOperation(POMModel model) {
for (org.apache.maven.shared.dependency.tree.DependencyNode nd : nds) {
Artifact directArt = nd.getArtifact();
org.netbeans.modules.maven.model.pom.Dependency dep = model.getProject().findDependencyById(directArt.getGroupId(), directArt.getArtifactId(), null);
if (dep == null) {
// now check the active profiles for the dependency..
List<String> profileNames = new ArrayList<String>();
Iterator it = data.getMavenProject().getActiveProfiles().iterator();
while (it.hasNext()) {
Profile prof = (Profile) it.next();
profileNames.add(prof.getId());
}
for (String profileId : profileNames) {
org.netbeans.modules.maven.model.pom.Profile modProf = model.getProject().findProfileById(profileId);
if (modProf != null) {
dep = modProf.findDependencyById(directArt.getGroupId(), directArt.getArtifactId(), null);
if (dep != null) {
break;
}
}
}
}
if (dep == null) {
// relocation maybe?
List<org.netbeans.modules.maven.model.pom.Dependency> deps = model.getProject().getDependencies();
for (org.netbeans.modules.maven.model.pom.Dependency d : deps) {
Relocation rel = getRelocation(d);
if(rel != null &&
rel.getArtifactId().equals(directArt.getArtifactId()) &&
rel.getGroupId().equals(directArt.getGroupId()) &&
rel.getVersion().equals(directArt.getVersion()))
{
dep = d;
break;
}
}
}
if (dep == null) {
dep = model.getFactory().createDependency();
dep.setGroupId(directArt.getGroupId());
dep.setArtifactId(directArt.getArtifactId());
dep.setVersion(directArt.getVersion());
if (!"jar".equals(directArt.getType())) {
dep.setType(directArt.getType());
}
model.getProject().addDependency(dep);
//mkleint: TODO why is the dependency being added? i forgot already..
}
Exclusion ex = dep.findExclusionById(art.getGroupId(), art.getArtifactId());
if (ex == null) {
Exclusion exclude = model.getFactory().createExclusion();
exclude.setGroupId(art.getGroupId());
exclude.setArtifactId(art.getArtifactId());
dep.addExclusion(exclude);
}
}
}
};
FileObject fo = FileUtil.toFileObject(data.project.getLookup().lookup(NbMavenProjectImpl.class).getPOMFile());
org.netbeans.modules.maven.model.Utilities.performPOMModelOperations(fo, Collections.singletonList(operation));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:65,代码来源:DependencyNode.java
示例16: replaceDistributionManagementRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
@Override
public Relocation replaceDistributionManagementRelocation( Relocation relocation )
{
return relocation;
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:6,代码来源:AbstractModelVisitor.java
示例17: replaceProfileDistributionManagementRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
@Override
public Relocation replaceProfileDistributionManagementRelocation( Relocation relocation )
{
return relocation;
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:6,代码来源:AbstractModelVisitor.java
示例18: visitDistributionManagementRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
@Override
public void visitDistributionManagementRelocation( Relocation relocation )
{
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:5,代码来源:AbstractModelVisitor.java
示例19: visitProfileDistributionManagementRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
@Override
public void visitProfileDistributionManagementRelocation( Relocation relocation )
{
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:5,代码来源:AbstractModelVisitor.java
示例20: replaceDistributionManagementRelocation
import org.apache.maven.model.Relocation; //导入依赖的package包/类
Relocation replaceDistributionManagementRelocation( Relocation relocation );
开发者ID:fedora-java,项目名称:xmvn,代码行数:2,代码来源:ModelVisitor.java
注:本文中的org.apache.maven.model.Relocation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论