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


Java Dependency.setVersion方法代碼示例

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


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

示例1: addDependency

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
    Dependency mavenDependency = new Dependency();
    mavenDependency.setGroupId(dependency.getGroupId());
    mavenDependency.setArtifactId(artifactId);
    mavenDependency.setVersion(mapToMavenSyntax(dependency.getVersion()));
    mavenDependency.setType(type);
    mavenDependency.setScope(scope);
    mavenDependency.setClassifier(classifier);

    for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
        exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
        mavenDependency.addExclusion(exclusion);
    }

    getModel().addDependency(mavenDependency);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:MavenPomFileGenerator.java

示例2: getDependencyList

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
public List getDependencyList( ArtifactItem item )
{
    Dependency dep = new Dependency();
    dep.setArtifactId( item.getArtifactId() );
    dep.setClassifier( item.getClassifier() );
    dep.setGroupId( item.getGroupId() );
    dep.setType( item.getType() );
    dep.setVersion( "2.0-SNAPSHOT" );

    Dependency dep2 = new Dependency();
    dep2.setArtifactId( item.getArtifactId() );
    dep2.setClassifier( "classifier" );
    dep2.setGroupId( item.getGroupId() );
    dep2.setType( item.getType() );
    dep2.setVersion( "2.1" );

    List list = new ArrayList( 2 );
    list.add( dep2 );
    list.add( dep );

    return list;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:23,代碼來源:TestUnpackMojo.java

示例3: getDependencyMgtList

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
public List getDependencyMgtList( ArtifactItem item )
{
    Dependency dep = new Dependency();
    dep.setArtifactId( item.getArtifactId() );
    dep.setClassifier( item.getClassifier() );
    dep.setGroupId( item.getGroupId() );
    dep.setType( item.getType() );
    dep.setVersion( "3.0-SNAPSHOT" );

    Dependency dep2 = new Dependency();
    dep2.setArtifactId( item.getArtifactId() );
    dep2.setClassifier( "classifier" );
    dep2.setGroupId( item.getGroupId() );
    dep2.setType( item.getType() );
    dep2.setVersion( "3.1" );

    List list = new ArrayList( 2 );
    list.add( dep2 );
    list.add( dep );

    return list;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:23,代碼來源:TestUnpackMojo.java

示例4: createDependency

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private Dependency createDependency( Artifact artifact )
{
    Dependency dep = new Dependency();
    dep.setArtifactId( artifact.getArtifactId() );
    if ( artifact.hasClassifier() )
    {
        dep.setClassifier( artifact.getClassifier() );
    }
    dep.setGroupId( artifact.getGroupId() );
    dep.setOptional( artifact.isOptional() );
    dep.setScope( artifact.getScope() );
    dep.setType( artifact.getType() );
    if ( useBaseVersion )
    {
        dep.setVersion( artifact.getBaseVersion() );
    }
    else
    {
        dep.setVersion( artifact.getVersion() );
    }
    return dep;
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:23,代碼來源:ShadeMojo.java

示例5: pomExecution

import org.apache.maven.model.Dependency; //導入方法依賴的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

示例6: getDependency

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private Dependency getDependency(String coordinates, String scope) {
  String[] coordinateArray = coordinates.split(":");
  Preconditions.checkState(coordinateArray.length == 3);
  Dependency dependency = new Dependency();
  dependency.setGroupId(coordinateArray[0]);
  dependency.setArtifactId(coordinateArray[1]);
  dependency.setVersion(coordinateArray[2]);
  dependency.setScope(scope);
  return dependency;
}
 
開發者ID:bazelbuild,項目名稱:migration-tooling,代碼行數:11,代碼來源:ResolverTest.java

示例7: syncDep

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
protected boolean syncDep ( final Dependency dep )
{
    final String id = String.format ( "%s:%s", dep.getGroupId (), dep.getArtifactId () );
    final String version = getVersionUnchecked ( "pom", id );
    if ( version != null )
    {
        getLog ().info ( String.format ( "Synchronizing depencency: %s -> %s", dep, version ) );
        dep.setVersion ( version );
        return true;
    }
    return false;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:13,代碼來源:AbstractSetQualifierMojo.java

示例8: smartTestingProviderDependency

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private Dependency smartTestingProviderDependency() {
    final Dependency smartTestingSurefireProvider = new Dependency();
    smartTestingSurefireProvider.setGroupId("org.arquillian.smart.testing");
    smartTestingSurefireProvider.setArtifactId("surefire-provider");
    smartTestingSurefireProvider.setVersion(ExtensionVersion.version().toString());
    smartTestingSurefireProvider.setScope("runtime");
    smartTestingSurefireProvider.setClassifier("shaded");
    return smartTestingSurefireProvider;
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:10,代碼來源:DependencyResolver.java

示例9: createDependencyFromCoordinates

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
static Dependency createDependencyFromCoordinates(String coordinatesString, boolean excludeTransitive) {
    final String[] coordinates = coordinatesString.split(":");
    int amountOfCoordinates = coordinates.length;
    if (amountOfCoordinates < 2) {
        throw new IllegalArgumentException(
            "Coordinates of the specified strategy [" + coordinatesString + "] doesn't have the correct format.");
    }
    final Dependency dependency = new Dependency();
    dependency.setGroupId(coordinates[0]);
    dependency.setArtifactId(coordinates[1]);
    if (amountOfCoordinates == 3) {
        dependency.setVersion(coordinates[2]);
    } else if (amountOfCoordinates >= 4) {
        dependency.setType(coordinates[2].isEmpty() ? "jar" : coordinates[2]);
        dependency.setClassifier(coordinates[3]);
    }
    if (amountOfCoordinates >= 5) {
        dependency.setVersion(coordinates[4]);
    }
    if (amountOfCoordinates == 6) {
        dependency.setScope(coordinates[5]);
    }
    if (dependency.getVersion() == null || dependency.getVersion().isEmpty()) {
        dependency.setVersion(ExtensionVersion.version().toString());
    }
    if (excludeTransitive) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId("*");
        exclusion.setArtifactId("*");
        dependency.setExclusions(Arrays.asList(exclusion));
    }
    return dependency;
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:34,代碼來源:MavenCoordinatesResolver.java

示例10: createDependency

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private Dependency createDependency(String groupId, String artifactId, String version) {
    Dependency dependency = new Dependency();
    dependency.setGroupId(groupId);
    dependency.setArtifactId(artifactId);
    dependency.setVersion(version);
    return dependency;
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:8,代碼來源:CustomProvidersTest.java

示例11: write

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
void write(Model model) {
    Dependency dependency = new Dependency();
    dependency.setGroupId(groupId);
    dependency.setArtifactId(artifactId);
    dependency.setVersion(version);
    model.addDependency(dependency);
}
 
開發者ID:PizzaCrust,項目名稱:IodineToolkit,代碼行數:8,代碼來源:DependencyData.java

示例12: processModules

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
public void processModules(ProjectBuildingRequest projectBuildingRequest, MavenProject project) {
	String modulesText = project.getProperties().getProperty(PROP_CONTRACTORS);
	if (modulesText == null || modulesText.trim().isEmpty()) {
		if (Flag.verbose()) {
			logger.info("No available modules in '{}'", PROP_CONTRACTORS);
		} else if (logger.isDebugEnabled()) {
			logger.debug("No available modules in '{}'", PROP_CONTRACTORS);
		}
		return;
	}
	String[] modulesArray = modulesText.split("[\\s]*[,\\n][\\s]*");
	Set<String> modulesSet = Arrays.stream(modulesArray).collect(Collectors.toSet());
	modulesSet.add("com.commsen.em.contractors:em.contractors.runtime:" + VAL_EXTENSION_VERSION);
	for (String moduleText : modulesSet) {
		String[] coordinates = moduleText.split(":");
		if (coordinates.length != 3) {
			logger.warn("Invalid maven coordinates for module '{}'! It will be ignored!", moduleText);
			continue;
		}

		Dependency dependency = new Dependency();
		dependency.setGroupId(coordinates[0]);
		dependency.setArtifactId(coordinates[1]);
		dependency.setVersion(coordinates[2]);
		dependency.setScope("runtime");
		dependency.setType("pom");

		try {
			Artifact pomArtifact = dependencies.asArtifact(projectBuildingRequest, dependency);
			dependency.setType("jar");
			MavenXpp3Reader reader = new MavenXpp3Reader();
			Model model = reader.read(new FileInputStream(pomArtifact.getFile()));
			DependencyManagement dm = model.getDependencyManagement();

			if (dm == null) {
				dependencies.addToDependencyManagement(project, dependency);
			} else {
				for (Dependency d : dm.getDependencies()) {
					/*
					 * TODO handle variables properly! For now assume variable is referring to the
					 * contract's artifact itself (that's what EM contractors do).
					 */
					if (d.getArtifactId().startsWith("${")) {
						dependencies.addToDependencyManagement(project, dependency);
					} else {
						dependencies.addToDependencyManagement(project, d);
					}
				}
			}

		} catch (Exception e) {
			logger.warn("Could not process modules from " + coordinates[0] + ":" + coordinates[1] + ":"
					+ coordinates[2], e);
		}
	}

}
 
開發者ID:commsen,項目名稱:EM,代碼行數:58,代碼來源:ExportMojo.java

示例13: createProjectDependencyPomModel

import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private Model createProjectDependencyPomModel(Model processingPomModel) {
    Model templateModel = new Model();
    templateModel.setModelVersion(processingPomModel.getModelVersion());
    templateModel.setGroupId("org.processing.idea");
    templateModel.setArtifactId("core");
    templateModel.setVersion("1.0.0");

    List<Dependency> artifactDependencies = new ArrayList<>(6);

    String joglVersion = null;
    for (Dependency dependency : processingPomModel.getDependencies()) {
        if (dependency.getGroupId().equals("org.jogamp.jogl") && dependency.getArtifactId().equals("jogl")) {
            joglVersion = dependency.getVersion();
        }
    }

    if (joglVersion == null) {
        throw new IllegalStateException("Unable to determine JOGL version used for this build of Processing.");
    }

    Dependency core = new Dependency();
    core.setGroupId("org.processing");
    core.setArtifactId("core");
    core.setVersion(version.toString());
    artifactDependencies.add(core);

    Dependency pdfExport = new Dependency();
    pdfExport.setGroupId(VanillaLibrary.PDF_EXPORT.getGroupId());
    pdfExport.setArtifactId(VanillaLibrary.PDF_EXPORT.getArtifactId());
    pdfExport.setVersion(version.toString());
    artifactDependencies.add(pdfExport);

    Dependency serial = new Dependency();
    serial.setGroupId(VanillaLibrary.SERIAL.getGroupId());
    serial.setArtifactId(VanillaLibrary.SERIAL.getArtifactId());
    serial.setVersion(version.toString());
    artifactDependencies.add(serial);

    Dependency network = new Dependency();
    network.setGroupId(VanillaLibrary.NETWORK.getGroupId());
    network.setArtifactId(VanillaLibrary.NETWORK.getArtifactId());
    network.setVersion(version.toString());
    artifactDependencies.add(network);

    Dependency gluegenRt = new Dependency();
    gluegenRt.setGroupId("org.jogamp.gluegen");
    gluegenRt.setArtifactId("gluegen-rt-main");
    gluegenRt.setVersion(joglVersion);
    artifactDependencies.add(gluegenRt);

    Dependency joglAllMain = new Dependency();
    joglAllMain.setGroupId("org.jogamp.jogl");
    joglAllMain.setArtifactId("jogl-all-main");
    joglAllMain.setVersion(joglVersion);
    artifactDependencies.add(joglAllMain);

    if (SystemInfo.isMac) {
        Dependency appleExtensions = new Dependency();
        appleExtensions.setGroupId("com.apple");
        appleExtensions.setArtifactId("AppleJavaExtensions");
        appleExtensions.setVersion("LATEST");
        artifactDependencies.add(appleExtensions);
    }

    templateModel.setDependencies(artifactDependencies);

    return templateModel;
}
 
開發者ID:mistodev,項目名稱:processing-idea,代碼行數:69,代碼來源:CreateVersionedProcessingPom.java


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