org.apache.maven.model.Prerequisites Java Examples

The following examples show how to use org.apache.maven.model.Prerequisites. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocationAwareMavenXpp3Writer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void writePrerequisites(Prerequisites prerequisites, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if ((prerequisites.getMaven() != null) && !prerequisites.getMaven().equals("2.0")) {
        writeValue(serializer, "maven", prerequisites.getMaven(), prerequisites);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(prerequisites, "", start, b.length());
}
 
Example #2
Source File: RequiredMavenVersionFinder.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private ArtifactVersion getPrerequisitesMavenVersion() {
    Prerequisites prerequisites = mavenProject.getPrerequisites();
    if (null == prerequisites) {
        return null;
    }

    String prerequisitesMavenValue = prerequisites.getMaven();
    if (null == prerequisitesMavenValue) {
        return null;
    }

    return new DefaultArtifactVersion(prerequisitesMavenValue);
}
 
Example #3
Source File: MavenCommandLineExecutor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private File guessBestMaven(RunConfig clonedConfig, InputOutput ioput) {
    MavenProject mp = clonedConfig.getMavenProject();
    if (mp != null) {
        if (mp.getPrerequisites() != null) {
            Prerequisites pp = mp.getPrerequisites();
            String ver = pp.getMaven();
            if (ver != null) {
                return checkAvailability(ver, null, ioput);
            }
        }
        String value = PluginPropertyUtils.getPluginPropertyBuildable(clonedConfig.getMavenProject(), Constants.GROUP_APACHE_PLUGINS, "maven-enforcer-plugin", "enforce", new PluginPropertyUtils.ConfigurationBuilder<String>() {
            @Override
            public String build(Xpp3Dom configRoot, ExpressionEvaluator eval) {
                if(configRoot != null) {
                    Xpp3Dom rules = configRoot.getChild("rules");
                    if (rules != null) {
                        Xpp3Dom rmv = rules.getChild("requireMavenVersion");
                        if (rmv != null) {
                            Xpp3Dom v = rmv.getChild("version");
                            if (v != null) {
                                return v.getValue();
                            }
                        }
                    }
                }
                return null;
            }
        });
        if (value != null) {
            if (value.contains("[") || value.contains("(")) {
                try {
                    VersionRange vr = VersionRange.createFromVersionSpec(value);
                    return checkAvailability(null, vr, ioput);
                } catch (InvalidVersionSpecificationException ex) {
                    Exceptions.printStackTrace(ex);
                }
            } else {
                return checkAvailability(value, null, ioput);
            }
        }
    }
    return null;
}
 
Example #4
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public Prerequisites get( Model model )
{
    return model.getPrerequisites();
}
 
Example #5
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void set( Model model, Prerequisites value )
{
    model.setPrerequisites( value );
}