Search in sources :

Example 1 with VersionsEngine

use of org.eclipse.tycho.versions.engine.VersionsEngine in project unleash-maven-plugin by shillner.

the class AbstractTychoVersionsStep method execute.

@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
    this.cachedPOMs = Maps.newHashMap();
    this.cachedModuleVersions = Maps.newHashMap();
    VersionsEngine versionsEngine = initializeVersionsEngine();
    try {
        for (MavenProject module : this.reactorProjects) {
            ArtifactCoordinates coordinates = ProjectToCoordinates.EMPTY_VERSION.apply(module);
            Optional<Document> parsedPOM = PomUtil.parsePOM(this.project);
            if (parsedPOM.isPresent()) {
                this.cachedPOMs.put(coordinates, parsedPOM.get());
            }
            this.cachedModuleVersions.put(coordinates, module.getVersion());
            Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(module.getGroupId(), module.getArtifactId());
            String version = coordinatesByPhase.get(currentReleasePhase()).getVersion();
            versionsEngine.addVersionChange(module.getArtifactId(), version);
            if (module.getModel().getVersion() != null) {
                module.getModel().setVersion(version);
            }
        }
        versionsEngine.apply();
        adaptProjectMetadataWithNewVersions();
    } catch (IOException e) {
        throw new MojoExecutionException("Error during tycho version upgrade.", e);
    }
}
Also used : MavenProject(org.apache.maven.project.MavenProject) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) ProjectToString(com.itemis.maven.plugins.unleash.util.functions.ProjectToString) IOException(java.io.IOException) VersionsEngine(org.eclipse.tycho.versions.engine.VersionsEngine) Document(org.w3c.dom.Document)

Example 2 with VersionsEngine

use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.

the class VersionsEngineTest method testAggregator.

public void testAggregator() throws Exception {
    File basedir = TestUtil.getBasedir("projects/aggregator");
    VersionsEngine engine = newEngine(basedir);
    engine.addVersionChange("aggregator", "1.0.1.qualifier");
    engine.addVersionChange("parent", "1.0.1.qualifier");
    engine.apply();
    assertPom(basedir);
    assertPom(new File(basedir, "parent"));
    assertPom(new File(basedir, "bundle"));
    assertBundleManifest(new File(basedir, "bundle"));
    assertPom(new File(basedir, "detached"));
    assertBundleManifest(new File(basedir, "detached"));
}
Also used : VersionsEngine(org.eclipse.tycho.versions.engine.VersionsEngine) File(java.io.File)

Example 3 with VersionsEngine

use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.

the class VersionsEngineTest method testExplicitVersion.

public void testExplicitVersion() throws Exception {
    File basedir = TestUtil.getBasedir("projects/exlicitversion");
    VersionsEngine engine = newEngine(basedir);
    engine.addVersionChange("parent", "1.0.1.qualifier");
    engine.apply();
    assertPom(basedir);
    assertPom(new File(basedir, "otherversion"));
    assertBundleManifest(new File(basedir, "otherversion"));
    assertPom(new File(basedir, "sameversion"));
    assertBundleManifest(new File(basedir, "sameversion"));
}
Also used : VersionsEngine(org.eclipse.tycho.versions.engine.VersionsEngine) File(java.io.File)

Example 4 with VersionsEngine

use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.

the class VersionsEngineTest method testDependencySimple.

public void testDependencySimple() throws Exception {
    File basedir = TestUtil.getBasedir("projects/dependencysimple");
    VersionsEngine engine = newEngine(basedir);
    engine.addVersionChange("someproject", "1.0.1.qualifier");
    engine.apply();
    assertPom(basedir);
    assertPom(new File(basedir, "bundle"));
    assertBundleManifest(new File(basedir, "bundle"));
    assertPom(new File(basedir, "someproject"));
}
Also used : VersionsEngine(org.eclipse.tycho.versions.engine.VersionsEngine) File(java.io.File)

Example 5 with VersionsEngine

use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.

the class VersionsEngineTest method testDependencyManagmentOtherVersion.

public void testDependencyManagmentOtherVersion() throws Exception {
    File basedir = TestUtil.getBasedir("projects/dependencymanagementotherversion");
    VersionsEngine engine = newEngine(basedir);
    engine.addVersionChange("someproject", "1.0.1.qualifier");
    engine.apply();
    assertPom(basedir);
    assertPom(new File(basedir, "bundle"));
    assertBundleManifest(new File(basedir, "bundle"));
    assertPom(new File(basedir, "someproject"));
}
Also used : VersionsEngine(org.eclipse.tycho.versions.engine.VersionsEngine) File(java.io.File)

Aggregations

VersionsEngine (org.eclipse.tycho.versions.engine.VersionsEngine)25 File (java.io.File)21 IOException (java.io.IOException)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 ArtifactCoordinates (com.itemis.maven.aether.ArtifactCoordinates)2 ProjectToString (com.itemis.maven.plugins.unleash.util.functions.ProjectToString)2 MavenProject (org.apache.maven.project.MavenProject)2 ProjectMetadataReader (org.eclipse.tycho.versions.engine.ProjectMetadataReader)2 Document (org.w3c.dom.Document)2 RollbackOnError (com.itemis.maven.plugins.cdi.annotations.RollbackOnError)1 ReleasePhase (com.itemis.maven.plugins.unleash.ReleasePhase)1 IllegalVersionChangeException (org.eclipse.tycho.versions.engine.IllegalVersionChangeException)1