本文整理汇总了Java中org.apache.maven.artifact.versioning.ComparableVersion类的典型用法代码示例。如果您正苦于以下问题:Java ComparableVersion类的具体用法?Java ComparableVersion怎么用?Java ComparableVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComparableVersion类属于org.apache.maven.artifact.versioning包,在下文中一共展示了ComparableVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkModuleInfoAndCompilerFit
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
/**
* Determines if the configured maven-compiler-plugin isn't too old in case
* there is a main module-info.java in the given project (has to be >= 3.6).
*
* @param prj the project to be checked
* @return <code>true</code> if there is no mofule-info file or if the m-c-p version is new enough (>= 3.6). Otherwise <code>false</code>
*/
public static boolean checkModuleInfoAndCompilerFit(Project prj) {
NbMavenProject nbprj = prj.getLookup().lookup(NbMavenProject.class);
if (nbprj == null) {
return true;
}
if (!hasModuleInfo(nbprj)) {
return true;
}
String version = PluginPropertyUtils.getPluginVersion(nbprj.getMavenProject(), Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER);
if (version == null) {
return true;
}
return new ComparableVersion(version).compareTo(new ComparableVersion(Constants.PLUGIN_COMPILER_VERSION_SUPPORTING_JDK9)) >= 0;
}
示例2: ContextBuildInstaller
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
public ContextBuildInstaller(Lookup actionContext) {
this.actionContext = actionContext;
putValue(NAME, NbBundle.getMessage(BuildInstallersAction.class, "CTL_BuildInstallers"));
putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
Project project = actionContext.lookup(Project.class);
if (project == null) {
setEnabled(false); //#224115
} else {
NbMavenProject watcher = project.getLookup().lookup(NbMavenProject.class);
if (watcher == null
|| !NbMavenProject.TYPE_NBM_APPLICATION.equalsIgnoreCase(watcher.getPackagingType())) {
setEnabled(false);
} else {
String version = PluginPropertyUtils.getPluginVersion(watcher.getMavenProject(), "org.codehaus.mojo", "nbm-maven-plugin");
if (version == null || new ComparableVersion(version).compareTo(new ComparableVersion("3.7-SNAPSHOT")) >= 0) {
setEnabled(false); // now handled by maven.apisupport
}
}
}
}
示例3: createCategory
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
@Messages("LBL_InstallerPanel=Installer")
@Override
public Category createCategory(Lookup context) {
Project project = context.lookup(Project.class);
NbMavenProject watcher = project.getLookup().lookup(NbMavenProject.class);
if (watcher!=null &&
NbMavenProject.TYPE_NBM_APPLICATION.equalsIgnoreCase(watcher.getPackagingType())) {
String version = PluginPropertyUtils.getPluginVersion(watcher.getMavenProject(), "org.codehaus.mojo", "nbm-maven-plugin");
if (version == null || new ComparableVersion(version).compareTo(new ComparableVersion("3.7-SNAPSHOT")) >= 0) {
return null; // now handled by maven.apisupport
}
return ProjectCustomizer.Category.create(
"Installer",
LBL_InstallerPanel(),
null,
(ProjectCustomizer.Category[])null);
}
return null;
}
示例4: reloadSubjects
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
/**
* Reload RadPlanBio subjects
*/
public void reloadSubjects() {
this.resetSubjects();
this.resetSubjectEvents();
this.resetDicomStudies();
try {
this.studyIntegrationFacade.init(this.mainBean);
// Faster load with new OC REST APIs
if (new ComparableVersion(
this.mainBean.getMyAccount().getPartnerSite().getEdc().getVersion()
)
.compareTo(
new ComparableVersion("3.7")
) >= 0) {
this.studyIntegrationFacade.setRetreiveStudySubjectOID(Boolean.FALSE);
}
this.studySubjectsList = this.studyIntegrationFacade.loadSubjects();
}
catch (Exception err) {
this.messageUtil.error(err);
}
}
示例5: reloadSubjectEvents
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
/**
* Reload RadPlanBio subject events
*/
public void reloadSubjectEvents() {
this.resetSubjectEvents();
this.resetDicomStudies();
try {
if (this.selectedStudySubject != null) {
this.studyIntegrationFacade.init(this.mainBean);
// Faster load with new OC REST APIs
if (new ComparableVersion(
this.mainBean.getMyAccount().getPartnerSite().getEdc().getVersion()
)
.compareTo(
new ComparableVersion("3.7")
) >= 0) {
this.studyIntegrationFacade.setRetreiveStudySubjectOID(Boolean.FALSE);
}
this.scheduledEventList = this.studyIntegrationFacade.loadSubjectEvents(this.selectedStudySubject);
}
}
catch (Exception err) {
this.messageUtil.error(err);
}
}
示例6: handleMavenPerfect
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
protected static void handleMavenPerfect ( final Supplier<Collection<ArtifactInformation>> artifactsSupplier, final ChannelId channelId, final LinkedList<String> path, final IOConsumer<MavenVersionedArtifact> consumer ) throws IOException
{
requirePathPrefix ( path, 3, "The 'maven' method requires at least one parameter: channel. e.g. /unzip/maven/perfect/<channelIdOrName>/<group.id>/<artifact.id>/<version>/path/to/file" );
final String groupId = path.pop ();
final String artifactId = path.pop ();
final String versionString = path.pop ();
final ComparableVersion v = new ComparableVersion ( versionString );
final List<MavenVersionedArtifact> arts = getMavenArtifacts ( channelId.getId (), artifactsSupplier, groupId, artifactId, true, ( a ) -> a.compareTo ( v ) == 0 );
if ( arts.isEmpty () )
{
// no result,
throw new IllegalStateException ( String.format ( "No artifacts found for - groupId: %s, artifactId: %s, version: %s", groupId, artifactId, v ) );
}
processArtifacts ( String.format ( "maven artifact %s/%s/%s in channel %s", groupId, artifactId, versionString, channelId.getId () ), arts, consumer );
}
示例7: parseVersion
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private static ComparableVersion parseVersion ( final String version )
{
if ( version == null )
{
return null;
}
try
{
return new ComparableVersion ( version );
}
catch ( final Exception e )
{
logger.debug ( "Version not parsable: " + version, e );
return null;
}
}
示例8: validateApplicationConfiguration
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
protected void validateApplicationConfiguration(final File resourcesDir) throws MojoExecutionException {
try {
final Optional<Dependency> dropwizardDependency = Iterables.tryFind(project.getModel().getDependencies(),
new DependencyFilter(DROPWIZARD_GROUP_ID, DROPWIZARD_ARTIFACT_ID));
if (!dropwizardDependency.isPresent()) {
log.warn("Failed to find Dropwizard dependency in project. Skipping configuration validation.");
return;
}
final ComparableVersion version = new ComparableVersion(dropwizardDependency.get().getVersion());
log.info(String.format("Detected Dropwizard %s, attempting to validate configuration.", version));
final File configFile = new File(resourcesDir, "/files" + path.getConfigFile());
final ApplicationValidator validator = new ApplicationValidator(artifactFile, log);
validator.validateConfiguration(configFile);
}
catch (IOException | IllegalArgumentException | ClassNotFoundException e) {
throw new MojoExecutionException("Failed to validate configuration", e);
}
}
示例9: getJUnitVersion
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private String getJUnitVersion(MavenProject prj) {
String juVersion = "";
for (Artifact a : prj.getArtifacts()) {
if ("junit".equals(a.getGroupId()) && ("junit".equals(a.getArtifactId()) || "junit-dep".equals(a.getArtifactId()))) { //junit-dep see #214238
String version = a.getVersion();
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("4.8")) >= 0) {
return "JUNIT4"; //NOI18N
}
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("3.8")) >= 0) {
return "JUNIT3"; //NOI18N
}
}
}
return juVersion;
}
示例10: usingJUnit4
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private boolean usingJUnit4(MavenProject prj) { // SUREFIRE-724
for (Artifact a : prj.getArtifacts()) {
if ("junit".equals(a.getGroupId()) && ("junit".equals(a.getArtifactId()) || "junit-dep".equals(a.getArtifactId()))) { //junit-dep see #214238
String version = a.getVersion();
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("4.8")) >= 0) {
return true;
}
}
}
return false;
}
示例11: createCategory
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
@Messages("LBL_InstallerPanel=Installer")
@Override public ProjectCustomizer.Category createCategory(Lookup context) {
Project project = context.lookup(Project.class);
NbMavenProject watcher = project.getLookup().lookup(NbMavenProject.class);
if (watcher != null && NbMavenProject.TYPE_NBM_APPLICATION.equalsIgnoreCase(watcher.getPackagingType())) {
String version = PluginPropertyUtils.getPluginVersion(watcher.getMavenProject(), MavenNbModuleImpl.GROUPID_MOJO, MavenNbModuleImpl.NBM_PLUGIN);
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("3.7-SNAPSHOT")) >= 0) {
return ProjectCustomizer.Category.create("Installer", LBL_InstallerPanel(), null);
}
}
return null;
}
示例12: usingJUnit4
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private boolean usingJUnit4() { // SUREFIRE-724
for (Artifact a : proj.getLookup().lookup(NbMavenProject.class).getMavenProject().getArtifacts()) {
if ("junit".equals(a.getGroupId()) && ("junit".equals(a.getArtifactId()) || "junit-dep".equals(a.getArtifactId()))) { //junit-dep see #214238
String version = a.getVersion();
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("4.8")) >= 0) {
return true;
}
}
}
return false;
}
示例13: isJDK9CompilerVersion
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private synchronized Boolean isJDK9CompilerVersion() {
if(jdk9compilerVersionOK == null) {
String version = PluginPropertyUtils.getPluginVersion(config.getMavenProject(), Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER);
jdk9compilerVersionOK = new ComparableVersion(version).compareTo(new ComparableVersion("3.6-SNAPSHOT")) >= 0 ? Boolean.TRUE : Boolean.FALSE;
}
return jdk9compilerVersionOK;
}
示例14: Branch
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
@Test
@Parameters({
"1.0-20160225-101534-abcdef, 1.0-20160225-101534-abcdef-SNAPSHOT", // Release after Snapshot
"1.0-20160225-101535-abcdef-SNAPSHOT, 1.0-20160225-101534-abcdef", // Dev after Release
"1.0-20160225-101534-abcdef, 1.0-B-12345-20160225-101534-abcdef", // Master after Branch (Same Commit)
"1.0-20160225-101534-abcdef, 1.0-B-12345-20160225-112123-fedcba" // Master after Branch (Branch Later)
})
public void testMavenVersionOrdering(String version1, String version2) {
ComparableVersion compare1 = new ComparableVersion(version1);
ComparableVersion compare2 = new ComparableVersion(version2);
Assert.assertEquals(1, compare1.compareTo(compare2));
}
示例15: newer
import org.apache.maven.artifact.versioning.ComparableVersion; //导入依赖的package包/类
private static boolean newer(MavenCoordinates coordinates, MavenCoordinates previousCoordinates) {
try {
ComparableVersion version1 = new ComparableVersion(coordinates.getVersion());
ComparableVersion version2 = new ComparableVersion(previousCoordinates.getVersion());
return version1.compareTo(version2) > 0;
} catch (IllegalArgumentException ex) {
return false;
}
}