當前位置: 首頁>>代碼示例>>Java>>正文


Java Model.getGroupId方法代碼示例

本文整理匯總了Java中org.apache.maven.model.Model.getGroupId方法的典型用法代碼示例。如果您正苦於以下問題:Java Model.getGroupId方法的具體用法?Java Model.getGroupId怎麽用?Java Model.getGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.model.Model的用法示例。


在下文中一共展示了Model.getGroupId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromPom

import org.apache.maven.model.Model; //導入方法依賴的package包/類
public static CarnotzetModuleCoordinates fromPom(@NonNull Path pom) {
	Model result;
	try {
		BufferedReader in = new BufferedReader(Files.newBufferedReader(pom, StandardCharsets.UTF_8));
		MavenXpp3Reader reader = new MavenXpp3Reader();
		result = reader.read(in);
	}
	catch (XmlPullParserException | IOException e) {
		throw new CarnotzetDefinitionException(e);
	}
	String groupId = result.getGroupId();
	String version = result.getVersion();
	if (groupId == null) {
		groupId = result.getParent().getGroupId();
	}
	if (version == null) {
		version = result.getParent().getVersion();
	}
	return new CarnotzetModuleCoordinates(groupId, result.getArtifactId(), version, null);
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:21,代碼來源:CarnotzetModuleCoordinates.java

示例2: updateParentIfPossible

import org.apache.maven.model.Model; //導入方法依賴的package包/類
private List<VersionChange> updateParentIfPossible(ModelWrapper wrapper, Versions versions,
		Model model, List<VersionChange> sourceChanges) {
	String rootProjectName = wrapper.projectName();
	String rootProjectGroupId = wrapper.groupId();
	List<VersionChange> changes = new ArrayList<>(sourceChanges);
	if (model.getParent() == null || isEmpty(model.getParent().getVersion())) {
		log.debug("Can't set the value for parent... Will return {}", sourceChanges);
		return changes;
	}
	if (model.getGroupId() != null && !model.getGroupId().equals(rootProjectGroupId)) {
		log.info("Will not update the project's [{}] parent [{}] since its group id [{}] is not equal the parent group id [{}]",
				model.getArtifactId(), model.getParent().getArtifactId(), model.getGroupId(), rootProjectGroupId);
		return changes;
	}
	String parentGroupId = model.getParent().getGroupId();
	String parentArtifactId = model.getParent().getArtifactId();
	log.debug("Searching for a version of parent [{}:{}]", parentGroupId, parentArtifactId);
	String oldVersion = model.getParent().getVersion();
	String version = versions.versionForProject(parentArtifactId);
	log.debug("Found version is [{}]", version);
	if (isEmpty(version)) {
		if (hasText(model.getParent().getRelativePath())) {
			version = versions.versionForProject(rootProjectName);
		} else {
			log.warn("There is no info on the [{}:{}] version", parentGroupId, parentArtifactId);
			return changes;
		}
	}
	if (oldVersion.equals(version)) {
		log.debug("Won't update the version of parent [{}:{}] since you're already using the proper one", parentGroupId, parentArtifactId);
		return changes;
	}
	log.info("Setting version of parent [{}] to [{}] for module [{}]", parentArtifactId,
			version, model.getArtifactId());
	if (hasText(version)) {
		changes.add(new VersionChange(parentGroupId, parentArtifactId, oldVersion, version));
	}
	return changes;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-release-tools,代碼行數:40,代碼來源:PomUpdater.java

示例3: loadPomVariables

import org.apache.maven.model.Model; //導入方法依賴的package包/類
private void loadPomVariables() {
    logger.debug("Loading maven pom.xml variables");
    MavenXpp3Reader reader = new MavenXpp3Reader();
    try {
        Model model = reader.read(new FileReader("pom.xml"));
        ARTIFACT_ID = model.getArtifactId();
        VERSION = model.getVersion();
        NAME = model.getName();
        GROUP_ID = model.getGroupId();
    } catch (IOException | XmlPullParserException e) {
        e.printStackTrace();
    }
}
 
開發者ID:jdesive,項目名稱:textmd,代碼行數:14,代碼來源:TextMd.java

示例4: groupId

import org.apache.maven.model.Model; //導入方法依賴的package包/類
private String groupId(Model model) {
	if (hasText(model.getGroupId())) {
		return model.getGroupId();
	}
	if (model.getParent() != null) {
		return model.getParent().getGroupId();
	}
	return "";
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-release-tools,代碼行數:10,代碼來源:PomUpdater.java


注:本文中的org.apache.maven.model.Model.getGroupId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。