本文整理了Java中org.apache.maven.model.Parent.setRelativePath()
方法的一些代码示例,展示了Parent.setRelativePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parent.setRelativePath()
方法的具体详情如下:
包路径:org.apache.maven.model.Parent
类名称:Parent
方法名:setRelativePath
[英]Set the relative path of the parent pom.xml
file within the check out. If not specified, it defaults to ../pom.xml
. Maven looks for the parent POM first in this location on the filesystem, then the local repository, and lastly in the remote repo. relativePath
allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent POM. However, the group ID, artifact ID and version are still required, and must match the file in the location given or it will revert to the repository for the POM. This feature is only for enhancing the development in a local checkout of that project. Set the value to an empty string in case you want to disable the feature and always resolve the parent POM from the repositories.
[中]设置签出中父pom.xml
文件的相对路径。如果未指定,则默认为[$1$]。Maven首先在文件系统的这个位置查找父POM,然后在本地存储库中查找,最后在远程repo中查找。relativePath
允许你选择一个不同的位置,例如当你的结构是平坦的,或者在没有中间父POM的情况下更深。但是,仍然需要组ID、工件ID和版本,并且必须与给定位置的文件匹配,否则它将恢复到POM的存储库。此功能仅用于增强该项目的本地签出中的开发。如果要禁用该功能并始终从存储库解析父POM,请将该值设置为空字符串。
代码示例来源:origin: apache/maven
protected void mergeParent_RelativePath( Parent target, Parent source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getRelativePath();
if ( src != null )
{
if ( sourceDominant || target.getRelativePath() == null )
{
target.setRelativePath( src );
target.setLocation( "relativePath", source.getLocation( "relativePath" ) );
}
}
}
代码示例来源:origin: apache/maven
protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
{
Parent src = source.getParent();
if ( src != null )
{
Parent tgt = target.getParent();
if ( tgt == null )
{
tgt = new Parent();
tgt.setRelativePath( null );
target.setParent( tgt );
}
mergeParent( tgt, src, sourceDominant, context );
}
}
代码示例来源:origin: org.apache.maven/maven-project
public static Parent cloneParent( Parent src )
{
if ( src == null )
{
return null;
}
Parent result = new Parent();
result.setArtifactId( src.getArtifactId() );
result.setGroupId( src.getGroupId() );
result.setRelativePath( src.getRelativePath() );
result.setVersion( src.getVersion() );
return result;
}
代码示例来源:origin: apache/maven
parent.setRelativePath( interpolatedTrimmed( parser.nextText(), "relativePath" ) );
代码示例来源:origin: apache/maven
parent.setRelativePath( interpolatedTrimmed( parser.nextText(), "relativePath" ) );
代码示例来源:origin: takari/polyglot-maven
parent.setRelativePath( getTrimmedValue( value ) );
代码示例来源:origin: takari/polyglot-maven
private Parent parent() {
if (match(Kind.PARENT) == null)
return null;
if (match(Kind.COLON) == null) {
log.severe("Expected ':' after 'inherits'");
return null;
}
Id parentId = id(true);
if (parentId == null) {
log.severe("Expected complete artifact identifier in 'parent' clause");
return null;
}
String relativePath = "../pom.atom";
if (match(Token.Kind.COLON) != null) {
relativePath = relativePath();
if (relativePath == null) {
return null;
}
}
Parent parent = new Parent();
parent.setGroupId(parentId.getGroup());
parent.setArtifactId(parentId.getArtifact());
parent.setVersion(parentId.getVersion());
parent.setRelativePath(relativePath);
return parent;
}
代码示例来源:origin: io.tesla.maven/maven-model
protected void mergeParent_RelativePath( Parent target, Parent source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getRelativePath();
if ( src != null )
{
if ( sourceDominant || target.getRelativePath() == null )
{
target.setRelativePath( src );
target.setLocation( "relativePath", source.getLocation( "relativePath" ) );
}
}
}
代码示例来源:origin: io.tesla.maven/maven-model
protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
{
Parent src = source.getParent();
if ( src != null )
{
Parent tgt = target.getParent();
if ( tgt == null )
{
tgt = new Parent();
tgt.setRelativePath( null );
target.setParent( tgt );
}
mergeParent( tgt, src, sourceDominant, context );
}
}
代码示例来源:origin: org.apache.felix/maven-bundle-plugin
model.getParent().setRelativePath( relPath );
model.getParent().setRelativePath( replaceRelativePath );
代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin
model.getParent().setRelativePath( relPath );
model.getParent().setRelativePath( replaceRelativePath );
代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects
Path relativePath = childPath.relativize(parentPomPath).normalize();
projectParent.setRelativePath(relativePath.toString());
代码示例来源:origin: io.tesla.polyglot/tesla-polyglot-atom
private Parent parent() {
if (match(Kind.PARENT) == null)
return null;
if (match(Kind.COLON) == null) {
log.severe("Expected ':' after 'inherits'");
return null;
}
Id parentId = id(true);
if (parentId == null) {
log.severe("Expected complete artifact identifier in 'parent' clause");
return null;
}
String relativePath = "../pom.atom";
if (match(Token.Kind.COLON) != null) {
relativePath = relativePath();
if (relativePath == null) {
return null;
}
}
Parent parent = new Parent();
parent.setGroupId(parentId.getGroup());
parent.setArtifactId(parentId.getArtifact());
parent.setVersion(parentId.getVersion());
parent.setRelativePath(relativePath);
return parent;
}
代码示例来源:origin: io.takari.polyglot/polyglot-atom
private Parent parent() {
if (match(Kind.PARENT) == null)
return null;
if (match(Kind.COLON) == null) {
log.severe("Expected ':' after 'inherits'");
return null;
}
Id parentId = id(true);
if (parentId == null) {
log.severe("Expected complete artifact identifier in 'parent' clause");
return null;
}
String relativePath = "../pom.atom";
if (match(Token.Kind.COLON) != null) {
relativePath = relativePath();
if (relativePath == null) {
return null;
}
}
Parent parent = new Parent();
parent.setGroupId(parentId.getGroup());
parent.setArtifactId(parentId.getArtifact());
parent.setVersion(parentId.getVersion());
parent.setRelativePath(relativePath);
return parent;
}
代码示例来源:origin: Adobe-Marketing-Cloud/aem-eclipse-developer-tools
private void fixParentProject(IProject p, IProject parentProject)
throws CoreException {
IFile existingPom = p.getFile("pom.xml");
Model model = MavenPlugin.getMavenModelManager().readMavenModel(existingPom);
Model parent = MavenPlugin.getMavenModelManager().readMavenModel(parentProject.getFile("pom.xml"));
//Parent oldParent = model.getParent();
Parent newParent = new Parent();
newParent.setGroupId(parent.getGroupId());
newParent.setArtifactId(parent.getArtifactId());
newParent.setRelativePath(calculateRelativePath(p, parentProject));
newParent.setVersion(parent.getVersion());
model.setParent(newParent);
// outright deletion doesn't work on windows as the process has a ref to the file itself
// so creating a temp '_newpom_.xml'
final IFile newPom = p.getFile("_newpom_.xml");
MavenPlugin.getMavenModelManager().createMavenModel(newPom, model);
// then copying that content over to the pom.xml
existingPom.setContents(newPom.getContents(), true, true, new NullProgressMonitor());
// and deleting the temp pom
newPom.delete(true, false, new NullProgressMonitor());
}
代码示例来源:origin: org.jboss.forge/forge-dev-plugins
parent.setRelativePath(relativePath);
parent.setRelativePath(relativePath);
parent.setGroupId(parentCore.getMavenProject().getGroupId());
parent.setVersion(parentCore.getMavenProject().getVersion());
parent.setRelativePath(relativePath);
代码示例来源:origin: io.tesla.maven/maven-model
parent.setRelativePath( getTrimmedValue( parser.nextText() ) );
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
String relPath = location.makeRelativeTo(location.append(moduleName)).toOSString();
if(!"..".equals(relPath)) { //$NON-NLS-1$
par.setRelativePath(relPath);
代码示例来源:origin: io.tesla.maven/maven-model
parent.setRelativePath( getTrimmedValue( parser.nextText() ) );
内容来源于网络,如有侵权,请联系作者删除!