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


Java Model.removeDependency方法代碼示例

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


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

示例1: pomExecution

import org.apache.maven.model.Model; //導入方法依賴的package包/類
@Override
protected TOExecutionResult pomExecution(String relativePomFile, Model model) {
    TOExecutionResult result = null;
    String details;

    Dependency dependency = getDependency(model, groupId, artifactId);
    if (dependency != null) {
        model.removeDependency(dependency);
        details = String.format("Dependency %s:%s has been removed from POM file %s", groupId, artifactId, relativePomFile);
        result = TOExecutionResult.success(this, details);
    } else {
        details = String.format("Dependency %s:%s has NOT been removed from POM file %s because it is not present", groupId, artifactId, relativePomFile);
        switch (ifNotPresent) {
            case Warn:
                result = TOExecutionResult.warning(this, new TransformationOperationException(details));
                break;
            case NoOp:
                result = TOExecutionResult.noOp(this, details);
                break;
            case Fail:
                // Fail is the default
            default:
                result = TOExecutionResult.error(this, new TransformationOperationException(details));
                break;
        }
    }

    return result;
}
 
開發者ID:paypal,項目名稱:butterfly,代碼行數:30,代碼來源:PomRemoveDependency.java

示例2: pomExecution

import org.apache.maven.model.Model; //導入方法依賴的package包/類
@Override
protected TOExecutionResult pomExecution(String relativePomFile, Model model) {
    TOExecutionResult result;

    Dependency dependency = getDependency(model, groupId, artifactId);
    if (dependency != null) {
        model.removeDependency(dependency);

        if (removeVersion) dependency.setVersion(null); else if (version != null) dependency.setVersion(version);
        if (removeScope) dependency.setScope(null); else if (scope != null) dependency.setScope(scope);
        if (removeType) dependency.setType(null); else if (type != null) dependency.setType(type);
        if (removeOptional) dependency.setOptional(null); else dependency.setOptional(optional);

        model.addDependency(dependency);

        String details = String.format("Dependency %s:%s has been changed in %s", groupId, artifactId, getRelativePath());
        result = TOExecutionResult.success(this, details);
    } else {
        String message = String.format("Dependency %s:%s is not present in %s", groupId, artifactId, getRelativePath());

        switch (ifNotPresent) {
            case Warn:
                result = TOExecutionResult.warning(this, new TransformationOperationException(message));
                break;
            case NoOp:
                result = TOExecutionResult.noOp(this, message);
                break;
            case Fail:
                // Fail is the default
            default:
                result = TOExecutionResult.error(this, new TransformationOperationException(message));
                break;
        }
    }

    return result;
}
 
開發者ID:paypal,項目名稱:butterfly,代碼行數:38,代碼來源:PomChangeDependency.java


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