本文整理匯總了Java中org.apache.maven.model.Parent.setGroupId方法的典型用法代碼示例。如果您正苦於以下問題:Java Parent.setGroupId方法的具體用法?Java Parent.setGroupId怎麽用?Java Parent.setGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.model.Parent
的用法示例。
在下文中一共展示了Parent.setGroupId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createModel
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private Model createModel(TaskContext taskContext, final Extension extension) {
final Model model = new Model();
model.setModelVersion(MODEL_VERSION);
model.setArtifactId(extension.getName());
model.setVersion(taskContext.getHybrisVersion().getVersion());
final Parent parent = new Parent();
parent.setGroupId(HYBRIS__GROUP_ID);
parent.setArtifactId(PLATFORM__ARTIFACT_ID);
parent.setVersion(taskContext.getHybrisVersion().getVersion());
model.setParent(parent);
setExtensionPackaging(taskContext, model);
addExtensionDependencies(taskContext, extension, model);
addImplicitDependencies(taskContext, extension, model);
addExternalDependencies(taskContext, extension, model);
// resolveDependencyVersionConflicts(taskContext, extension, model);
return model;
}
示例2: saveMavenParentInfo
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private void saveMavenParentInfo(MavenProjectInfo projectInfo) throws IOException, XmlPullParserException {
File mavenProjectPomLocation = projectInfo.getPomFile();// project.getFile(POM_FILE).getLocation().toFile();
MavenProject mavenProject = null;
mavenProject = MavenUtils.getMavenProject(mavenProjectPomLocation);
Parent msf4jParent = new Parent();
msf4jParent.setGroupId(MSF4J_SERVICE_PARENT_GROUP_ID);
msf4jParent.setArtifactId(MSF4J_SERVICE_PARENT_ARTIFACT_ID);
msf4jParent.setVersion(MSF4JArtifactConstants.getMSF4JServiceParentVersion());
mavenProject.getModel().setParent(msf4jParent);
Properties generatedProperties = mavenProject.getModel().getProperties();
generatedProperties.clear();
mavenProject.getModel().addProperty(MSF4J_MAIN_CLASS_PROPERTY, DEFAULT_MAIN_CLASS_PROPERTY_VALUE);
MavenUtils.saveMavenProject(mavenProject, mavenProjectPomLocation);
}
示例3: fixParentProject
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
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());
}
開發者ID:Adobe-Marketing-Cloud,項目名稱:aem-eclipse-developer-tools,代碼行數:23,代碼來源:NewGraniteProjectWizard.java
示例4: addDependencies
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
protected void addDependencies() {
Parent p = new Parent();
p.setGroupId(GRIFFON_GROUP_ID);
p.setArtifactId(GRIFFON_MASTERPOM_ARTIFACT_ID);
p.setVersion("1.0.0");
MavenFacet mavenFacet = getFaceted().getFacet(MavenFacet.class);
Model model = mavenFacet.getModel();
model.setParent(p);
mavenFacet.setModel(model);
DependencyFacet facet = getFaceted().getFacet(DependencyFacet.class);
facet.addRepository("jcenter","http://jcenter.bintray.com");
facet.addRepository("griffon-plugins","http://dl.bintray.com/griffon/griffon-plugins");
MetadataFacet mdfacet = getFaceted().getFacet(MetadataFacet.class);
mdfacet.setDirectProperty("griffon.version","2.2.0");
mdfacet.setDirectProperty("application.main.class",mdfacet.getProjectGroupName()+".Launcher");
mdfacet.setDirectProperty("maven.compiler.source","1.8");
mdfacet.setDirectProperty("maven.compiler.target","1.8");
builder = DependencyBuilder.create();
addDependency(LOG4J);
addDependency(SLF4J_LOG4J12);
addDependency(SPOCK_CORE);
addDependency(JUNIT);
}
示例5: testIdentityProtoInheritance
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
public void testIdentityProtoInheritance()
{
Parent parent = new Parent();
parent.setGroupId( "test-group" );
parent.setVersion( "1000" );
parent.setArtifactId( "test-artifact" );
Model model = new Model();
model.setParent( parent );
model.setArtifactId( "real-artifact" );
MavenProject project = new MavenProject( model );
assertEquals( "groupId proto-inheritance failed.", "test-group", project.getGroupId() );
assertEquals( "artifactId is masked.", "real-artifact", project.getArtifactId() );
assertEquals( "version proto-inheritance failed.", "1000", project.getVersion() );
// draw the NPE.
project.getId();
}
示例6: pomExecution
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
@Override
protected TOExecutionResult pomExecution(String relativePomFile, Model model) {
String details;
Parent parent = model.getParent();
if (parent == null) {
String message = String.format("Pom file %s does not have a parent", getRelativePath());
switch (ifNotPresent) {
case Warn:
return TOExecutionResult.warning(this, new TransformationOperationException(message));
case NoOp:
return TOExecutionResult.noOp(this, message);
case Fail:
// Fail is the default
default:
return TOExecutionResult.error(this, new TransformationOperationException(message));
}
}
if(groupId != null && artifactId != null && version != null) {
parent.setGroupId(groupId);
parent.setArtifactId(artifactId);
parent.setVersion(version);
String newParent = parent.toString();
details = String.format("Parent for POM file (%s) has been set to %s", relativePomFile, newParent);
} else if (groupId == null && artifactId == null && version != null) {
String oldVersion = parent.getVersion();
parent.setVersion(version);
details = String.format("Parent's version for POM file (%s) has been changed from %s to %s", relativePomFile, oldVersion, version);
} else {
// FIXME this should be in a pre-validation
return TOExecutionResult.error(this, new TransformationOperationException("Invalid POM parent transformation operation"));
}
return TOExecutionResult.success(this, details);
}
示例7: ParentData
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
public ParentData(File parentPom) {
try {
parent = new Parent();
Model model = new MavenXpp3Reader().read(new FileReader(parentPom));
parent.setVersion(model.getVersion());
parent.setArtifactId(model.getArtifactId());
parent.setGroupId(model.getGroupId());
} catch (Exception e) {
parent = null;
}
}
示例8: testSetParentVersion
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
@Test
public void testSetParentVersion() throws Exception {
URL url = getClass().getResource(getClass().getSimpleName() + "/pom1.xml");
File source;
try {
source = new File(url.toURI());
} catch (URISyntaxException e) {
source = new File(url.getPath());
}
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(source);
Model model = new Model();
model.setGroupId("com.itemis.maven.plugins");
model.setArtifactId("test-project-1");
model.setVersion("1");
Parent parent = new Parent();
parent.setGroupId("com.itemis");
parent.setArtifactId("org-parent");
parent.setVersion("1");
model.setParent(parent);
String newVersion = "2";
PomUtil.setParentVersion(model, document, newVersion);
Assert.assertEquals(newVersion, getNode(document.getDocumentElement(), "parent/version").getTextContent());
Assert.assertEquals(newVersion, model.getParent().getVersion());
}
示例9: addParent
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private Model addParent(Model model, String parentGroupId, String parentArtifactId, String parentVersion) {
if (model == null) return null;
Parent p = new Parent();
p.setGroupId(parentGroupId);
p.setArtifactId(parentArtifactId);
p.setVersion(parentVersion);
if (!(model.getGroupId()+":"+model.getArtifactId()).equals(parentGroupId+":"+parentArtifactId)) {
model.setParent(p);
}
return model;
}
示例10: convertToMavenModel
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
public static Model convertToMavenModel(MavenModel model, File projectDir) {
Model result = new Model();
result.setArtifactId(model.getMavenKey().getArtifactId());
result.setGroupId(model.getMavenKey().getGroupId());
result.setVersion(model.getMavenKey().getVersion());
result.setPackaging(model.getPackaging());
result.setName(model.getName());
if (model.getParent() != null) {
Parent parent = new Parent();
MavenKey parentKey = model.getParent().getMavenKey();
parent.setArtifactId(parentKey.getArtifactId());
parent.setGroupId(parentKey.getGroupId());
parent.setVersion(parentKey.getVersion());
parent.setRelativePath(model.getParent().getRelativePath());
result.setParent(parent);
}
result.setProperties(model.getProperties());
result.setModules(model.getModules());
result.setBuild(new Build());
MavenBuild modelBuild = model.getBuild();
convertToMavenBuildBase(modelBuild, result.getBuild(), projectDir);
result.getBuild().setSourceDirectory(relativize(projectDir, modelBuild.getSources().get(0)));
result
.getBuild()
.setTestSourceDirectory(relativize(projectDir, modelBuild.getTestSources().get(0)));
result.getBuild().setOutputDirectory(modelBuild.getOutputDirectory());
result.getBuild().setTestOutputDirectory(modelBuild.getTestOutputDirectory());
result.setProfiles(convertToMavenProfiles(model.getProfiles(), projectDir));
return result;
}
示例11: updatePom
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
/**
* Update created pom.xml file with necessary dependencies and plug-ins so
* that it works with WSO2 MSF4J server
*
* @throws IOException
* @throws XmlPullParserException
*
*/
private void updatePom(IProject project) throws IOException, XmlPullParserException {
File mavenProjectPomLocation = project.getFile(POM_FILE).getLocation().toFile();
MavenProject mavenProject = MavenUtils.getMavenProject(mavenProjectPomLocation);
Parent msf4jParent = new Parent();
msf4jParent.setGroupId(MSF4J_SERVICE_PARENT_GROUP_ID);
msf4jParent.setArtifactId(MSF4J_SERVICE_PARENT_ARTIFACT_ID);
msf4jParent.setVersion(MSF4JArtifactConstants.getMSF4JServiceParentVersion());
mavenProject.getModel().setParent(msf4jParent);
Properties generatedProperties = mavenProject.getModel().getProperties();
generatedProperties.clear();
}
示例12: mavenModelToArtifactInfoGroupIdInParent
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
public void mavenModelToArtifactInfoGroupIdInParent() {
Model model = new MavenPomBuilder().artifactId("myArtifactId").version("1.0.0").build();
Parent parent = new Parent();
parent.setGroupId("parentGroupId");
parent.setArtifactId("parentArifactId");
parent.setVersion("1.2.0");
model.setParent(parent);
MavenArtifactInfo artifactInfo = MavenModelUtils.mavenModelToArtifactInfo(model);
assertEquals(artifactInfo.getGroupId(), "parentGroupId");
assertEquals(artifactInfo.getArtifactId(), "myArtifactId");
assertEquals(artifactInfo.getVersion(), "1.0.0");
}
示例13: getParent
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private Parent getParent(final POM pom) {
if (pom.getParent() == null) {
return null;
} else {
Parent parent = new Parent();
parent.setGroupId(pom.getParent().getGroupId());
parent.setArtifactId(pom.getParent().getArtifactId());
parent.setVersion(pom.getParent().getVersion());
return parent;
}
}
示例14: getParentFromPreferernceStore
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private Parent getParentFromPreferernceStore() {
Parent parent = new Parent();
parent.setGroupId(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
GLOBAL_PARENT_MAVEN_GROUP_ID, null, null));
parent.setArtifactId(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
GLOBAL_PARENT_MAVEN_ARTIFACTID, null, null));
parent.setVersion(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
GLOBAL_PARENT_MAVEN_VERSION, null, null));
parent.setRelativePath(null);
return parent;
}
示例15: updateParent
import org.apache.maven.model.Parent; //導入方法依賴的package包/類
private void updateParent() {
Parent parent = new Parent();
parent.setArtifactId(getParentArtifactID());
parent.setGroupId(getParentGroupID());
parent.setVersion(getParentVersion());
parent.setRelativePath(getParentRelativePath());
mavenProjectInfo.setParentProject(parent);
dataModel.setMavenInfo(mavenProjectInfo);
}