public int getMajorVersion() { return version.getMajorVersion(); }
private boolean equalMinorAndMajor(ArtifactVersion left, ArtifactVersion right){ return left.getMajorVersion()==right.getMajorVersion() && left.getMinorVersion() == right.getMinorVersion(); } }
private void checkMavenVersion() throws MojoExecutionException { if (runtimeInformation.getApplicationVersion().getMajorVersion() == 3) { throw new MojoExecutionException("The Spock Maven plugin is not compatible with Maven 3. To use Spock with " + "Maven 3, remove this plugin and make sure that your spec classes adhere to Surefire's naming conventions " + "(e.g. '*Test'). You can also configure Surefire to support other naming conventions (e.g. '*Spec')."); } }
private void warnIfMaven2( EnforcerRuleHelper helper ) { final Log log = helper.getLog(); RuntimeInformation rti; try { rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class ); ArtifactVersion detectedMavenVersion = rti.getApplicationVersion(); log.debug( "Detected Maven Version: " + detectedMavenVersion ); if ( detectedMavenVersion.getMajorVersion() == 2 ) { log.warn( "Circular dependencies cannot exist with Maven 2. " + "So that rule is of no use for that Maven version. " + "See rule documentation at " + "http://mojo.codehaus.org/extra-enforcer-rules/banCircularDependencies.html" ); } } catch ( ComponentLookupException e ) { log.warn( "Unable to detect Maven version. Please report this issue to the mojo@codehaus project" ); } }
for ( ArtifactVersion artifactVersion : newerVersions ) if ( artifactVersion.getMajorVersion() != selectedVersion.getMajorVersion() )
for ( ArtifactVersion artifactVersion : newerVersions ) if ( artifactVersion.getMajorVersion() != selectedVersion.getMajorVersion() )
if( len >= 1 ) versionBuffer.append( artifactVersion.getMajorVersion() );
private void ensureSARLVersions() throws MojoExecutionException, MojoFailureException { final String compilerVersionString = this.mavenHelper.getConfig("plugin.version"); //$NON-NLS-1$ final ArtifactVersion compilerVersion = new DefaultArtifactVersion(compilerVersionString); final ArtifactVersion maxCompilerVersion = new DefaultArtifactVersion( compilerVersion.getMajorVersion() + "." //$NON-NLS-1$ + (compilerVersion.getMinorVersion() + 1) + ".0"); //$NON-NLS-1$ getLog().info(MessageFormat.format(Messages.CompileMojo_0, compilerVersionString, maxCompilerVersion)); final StringBuilder classpath = new StringBuilder(); final Set<String> foundVersions = findSARLLibrary(compilerVersion, maxCompilerVersion, classpath, this.tycho); if (foundVersions.isEmpty()) { throw new MojoFailureException(MessageFormat.format(Messages.CompileMojo_1, classpath.toString())); } final StringBuilder versions = new StringBuilder(); for (final String version : foundVersions) { if (versions.length() > 0) { versions.append(", "); //$NON-NLS-1$ } versions.append(version); } if (foundVersions.size() > 1) { getLog().info(MessageFormat.format(Messages.CompileMojo_2, versions)); } else { getLog().info(MessageFormat.format(Messages.CompileMojo_3, versions)); } }
if ( ( v.getMajorVersion() != 0 || v.getMinorVersion() != 0 || v.getIncrementalVersion() != 0 ) && v.getQualifier() != null )
newVersion.append(segment >= 0 ? version.getMajorVersion() : 0); if (segmentCount > 0)
if ( ( v.getMajorVersion() != 0 || v.getMinorVersion() != 0 || v.getIncrementalVersion() != 0 ) && v.getQualifier() != null )
newVersion.append(segment >= 0 ? version.getMajorVersion() : 0); if (segmentCount > 0)
public static String calculateVersionTagNamePart(String version, CalculateRuleForSinceTagName calculateRuleForSinceTagName) { if (calculateRuleForSinceTagName.equals(CalculateRuleForSinceTagName.NO_RULE)) { return null; } ArtifactVersion artifactVersion = parseArtifactVersion(version); int major = artifactVersion.getMajorVersion(); int minor = artifactVersion.getMinorVersion(); int patch = artifactVersion.getIncrementalVersion(); switch (calculateRuleForSinceTagName) { case CURRENT_MAJOR_VERSION: minor = 0; patch = 0; break; case CURRENT_MINOR_VERSION: patch = 0; break; case LATEST_RELEASE_VERSION: patch = patch == 0 ? 0 : patch - 1; break; default: throw new RuntimeException("cannot parse " + calculateRuleForSinceTagName); } return major + "." + minor + "." + patch; }
int major = v.getMajorVersion(); int minor = v.getMinorVersion(); int incremental = v.getIncrementalVersion();
int major = v.getMajorVersion(); int minor = v.getMinorVersion(); int incremental = v.getIncrementalVersion();
public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { String javaVersion = SystemUtils.JAVA_VERSION_TRIMMED; Log log = helper.getLog(); log.debug( "Detected Java String: " + javaVersion ); javaVersion = normalizeJDKVersion( javaVersion ); log.debug( "Normalized Java String: " + javaVersion ); ArtifactVersion detectedJdkVersion = new DefaultArtifactVersion( javaVersion ); log.debug( "Parsed Version: Major: " + detectedJdkVersion.getMajorVersion() + " Minor: " + detectedJdkVersion.getMinorVersion() + " Incremental: " + detectedJdkVersion.getIncrementalVersion() + " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: " + detectedJdkVersion.getQualifier() ); enforceVersion( helper.getLog(), "JDK", getVersion(), detectedJdkVersion ); }
@Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { String javaVersion = SystemUtils.JAVA_VERSION; Log log = helper.getLog(); log.debug( "Detected Java String: '" + javaVersion + "'" ); javaVersion = normalizeJDKVersion( javaVersion ); log.debug( "Normalized Java String: '" + javaVersion + "'" ); ArtifactVersion detectedJdkVersion = new DefaultArtifactVersion( javaVersion ); log.debug( "Parsed Version: Major: " + detectedJdkVersion.getMajorVersion() + " Minor: " + detectedJdkVersion.getMinorVersion() + " Incremental: " + detectedJdkVersion.getIncrementalVersion() + " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: " + detectedJdkVersion.getQualifier() ); enforceVersion( helper.getLog(), "JDK", getVersion(), detectedJdkVersion ); }
defineVersionProperty( "majorVersion", releasedVersion.getMajorVersion() ); defineVersionProperty( "minorVersion", releasedVersion.getMinorVersion() ); defineVersionProperty( "incrementalVersion", releasedVersion.getIncrementalVersion() );
defineVersionProperty( "majorVersion", releasedVersion.getMajorVersion() ); defineVersionProperty( "minorVersion", releasedVersion.getMinorVersion() ); defineVersionProperty( "incrementalVersion", releasedVersion.getIncrementalVersion() );