public String computeReleaseVersion() { String version = "NaN"; final MavenModule rootModule = getRootModule(); if (rootModule != null && StringUtils.isNotBlank(rootModule.getVersion())) { try { DefaultVersionInfo dvi = new DefaultVersionInfo(rootModule.getVersion()); version = dvi.getReleaseVersionString(); } catch (VersionParseException vpEx) { LOGGER.log(Level.WARNING, "Failed to compute next version.", vpEx); version = rootModule.getVersion().replace("-SNAPSHOT", ""); } } return version; }
public String getCurrentVersion() { return getRootModule().getVersion(); }
public String computeNextVersion() { String version = "NaN-SNAPSHOT"; final MavenModule rootModule = getRootModule(); if (rootModule != null && StringUtils.isNotBlank(rootModule.getVersion())) { try { DefaultVersionInfo dvi = new DefaultVersionInfo(rootModule.getVersion()); version = dvi.getNextVersion().getSnapshotVersionString(); } catch (Exception vpEx) { LOGGER.log(Level.WARNING, "Failed to compute next version.", vpEx); } } return version; }
/** * Check if the current build is a release or not. * If all its maven modules are not SNAPSHOT then it is a release * * @since 2.12.2 * @return true if {@link MavenModuleSetBuild} is a release */ protected Boolean isRelease() { MavenModuleSet mavenModuleSet = this.getProject(); for (MavenModule mavenModule : mavenModuleSet.getModules()) { if (ArtifactUtils.isSnapshot(mavenModule.getVersion())) { return false; } } return true; }
@Override protected void prepareBuilderSpecificDefaultModules() { defaultModules = Maps.newHashMap(); if (project != null) { List<MavenModule> modules = project.getDisabledModules(false); for (MavenModule mavenModule : modules) { String version = mavenModule.getVersion(); String moduleName = mavenModule.getModuleName().toString(); defaultModules.put(moduleName, new VersionedModule(moduleName, calculateReleaseVersion(version), calculateNextVersion(version))); } } }
@Override protected void prepareBuilderSpecificDefaultGlobalModule() { if ((project != null) && (getRootModule() != null)) { String releaseVersion = calculateReleaseVersion(getRootModule().getVersion()); defaultGlobalModule = new VersionedModule(null, releaseVersion, calculateNextVersion(releaseVersion)); } }
private void gatherModuleAndDependencyInfo(MavenModuleSetBuild mavenModulesBuild) { Map<MavenModule, MavenBuild> mavenBuildMap = mavenModulesBuild.getModuleLastBuilds(); List<Module> modules = Lists.newArrayList(); for (Map.Entry<MavenModule, MavenBuild> moduleBuild : mavenBuildMap.entrySet()) { MavenModule mavenModule = moduleBuild.getKey(); MavenBuild mavenBuild = moduleBuild.getValue(); Result result = mavenBuild.getResult(); if (Result.NOT_BUILT.equals(result)) { // HAP-52 - the module build might be skipped if using incremental build continue; } MavenArtifactRecord mar = ActionableHelper.getLatestMavenArtifactRecord(mavenBuild); String moduleId = mavenModule.getName() + ":" + mavenModule.getVersion(); ModuleBuilder moduleBuilder = new ModuleBuilder().id(moduleId); // add artifacts moduleBuilder.addArtifact(toArtifact(mar.mainArtifact)); if (!mar.isPOM() && mar.pomArtifact != null && mar.pomArtifact != mar.mainArtifact) { moduleBuilder.addArtifact(toArtifact(mar.pomArtifact)); } for (MavenArtifact attachedArtifact : mar.attachedArtifacts) { moduleBuilder.addArtifact(toArtifact(attachedArtifact)); } addDependencies(moduleBuilder, mavenBuild); modules.add(moduleBuilder.build()); } buildInfo.setModules(modules); }
envs.putIfNotNull("POM_VERSION", root.getVersion()); envs.putIfNotNull("POM_GROUPID", root.getGroupId()); envs.putIfNotNull("POM_ARTIFACTID", root.getArtifactId());