Java Code Examples for org.apache.maven.model.Model#addProperty()

The following examples show how to use org.apache.maven.model.Model#addProperty() . These examples are extracted from open source projects. 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 Project: helidon-build-tools   File: PomUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static boolean ensurePluginVersion(Model model, String helidonPluginVersion) {
    Properties properties = model.getProperties();
    String existing = properties.getProperty(HELIDON_PLUGIN_VERSION_PROPERTY);
    if (existing == null || !existing.equals(helidonPluginVersion)) {
        model.addProperty(HELIDON_PLUGIN_VERSION_PROPERTY, helidonPluginVersion);
        return true;
    } else {
        return false;
    }
}
 
Example 2
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    String openLibertyVersion = "[19.0.0.9,)";
    String openLibertyMavenVersion = "3.2";
    pomFile.addProperty("openliberty.version", openLibertyVersion);
    pomFile.addProperty("openliberty.maven.version", openLibertyMavenVersion);

}
 
Example 3
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    String payaraVersion = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP33:
            payaraVersion = "5.2020.2";
            break;
        case MP32:
            payaraVersion = "5.194";
            break;
        case MP22:
            payaraVersion = "5.192";
            break;
        case MP21:
            payaraVersion = "5.191";
            break;
        case MP20:
            payaraVersion = "5.183";
            break;
        case MP14:
            payaraVersion = "5.183";
            break;
        case MP13:
            payaraVersion = "5.182";
            break;
        case MP12:
            payaraVersion = "5.181";
            break;
        default:
    }
    pomFile.addProperty("payaraVersion", payaraVersion);
}
 
Example 4
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    String tomeeVersion = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP22:
            break;
        case MP21:
            tomeeVersion = "8.0.0-M3";
            break;
        case MP20:
            tomeeVersion = "8.0.0-M3";
            break;
        case MP14:
            tomeeVersion = "8.0.0-M3";
            break;
        case MP13:
            tomeeVersion = "8.0.0-M3";
            break;
        case MP12:
            tomeeVersion = "8.0.0-M3";
            break;
        default:
    }
    pomFile.addProperty("tomee.version", tomeeVersion);

    adjustPOM(pomFile, model, mainProject);

}
 
Example 5
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    String thorntailVersion = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP33:
            thorntailVersion = "2.7.0.Final";
            break;
        case MP32:
            thorntailVersion = "2.7.0.Final";
            break;
        case MP30:
            thorntailVersion = "2.5.0.Final";
            break;
        case MP22:
            thorntailVersion = "2.4.0.Final";
            break;
        case MP21:
            thorntailVersion = "2.3.0.Final";
            break;
        case MP20:
            break;
        case MP14:
            break;
        case MP13:
            thorntailVersion = "2.1.0.Final";
            break;
        case MP12:
            thorntailVersion = "2.0.0.Final";
            break;
        default:
    }
    pomFile.addProperty("version.thorntail", thorntailVersion);

}
 
Example 6
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    String quarkusVersion = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP32:
            quarkusVersion = "1.3.4.Final";
            break;
        case MP30:
            break;
        case MP22:
            break;
        case MP21:
            break;
        case MP20:
            break;
        case MP14:
            break;
        case MP13:
            break;
        case MP12:
            break;
        default:
    }
    pomFile.addProperty("version.quarkus", quarkusVersion);
    List<MicroprofileSpec> microprofileSpecs = model.getParameter(JessieModel.Parameter.MICROPROFILESPECS);

    Profile nativeProfile = pomFile.getProfiles().get(0).clone();
    nativeProfile.setId("native");
    nativeProfile.getActivation().setActiveByDefault(false);
    nativeProfile.getBuild().getPlugins().get(0).getExecutions().get(0).setGoals(Collections.singletonList("native-image"));

    Xpp3Dom configuration = new Xpp3Dom("configuration");

    Xpp3Dom enableHttpUrlHandler = new Xpp3Dom("enableHttpUrlHandler");
    enableHttpUrlHandler.setValue("true");
    configuration.addChild(enableHttpUrlHandler);

    if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH) && mainProject) {
        Xpp3Dom additionalBuildArgsLog = new Xpp3Dom("additionalBuildArgs");
        additionalBuildArgsLog.setValue("-H:Log=registerResource:");
        configuration.addChild(additionalBuildArgsLog);

        Xpp3Dom additionalBuildArgsResources = new Xpp3Dom("additionalBuildArgs");
        additionalBuildArgsResources.setValue("-H:IncludeResources=privateKey.pem");
        configuration.addChild(additionalBuildArgsResources);
    }

    nativeProfile.getBuild().getPlugins().get(0).setConfiguration(configuration);

    pomFile.addProfile(nativeProfile);

    // We add Rest by default as all our examples use it anyway.
    mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-resteasy", "${version.quarkus}");

    //if (microprofileSpecs.contains(MicroprofileSpec.CONFIG)) {
    // Config is present by default.
    //}
    if (microprofileSpecs.contains(MicroprofileSpec.FAULT_TOLERANCE) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-fault-tolerance", "${version.quarkus}");
    }
    if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH)) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-jwt", "${version.quarkus}");
    }
    if (microprofileSpecs.contains(MicroprofileSpec.METRICS) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-metrics", "${version.quarkus}");
    }
    if (microprofileSpecs.contains(MicroprofileSpec.HEALTH_CHECKS) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-health", "${version.quarkus}");
    }
    if (microprofileSpecs.contains(MicroprofileSpec.OPEN_API) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-openapi", "${version.quarkus}");
    }
    if (microprofileSpecs.contains(MicroprofileSpec.OPEN_TRACING)) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-opentracing", "${version.quarkus}");
    }
    if ((microprofileSpecs.contains(MicroprofileSpec.REST_CLIENT) || microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH)) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-rest-client", "${version.quarkus}");
    }
}
 
Example 7
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    // KumuluzEE needs jar packaging
    pomFile.setPackaging("jar");


    String kumuluzVersion = "";
    String kumuluzeeConfigVersion = "";
    String artifactId = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP33:
            kumuluzVersion = "3.9.0";
            kumuluzeeConfigVersion = "1.4.0";
            artifactId = "kumuluzee-microProfile-3.3";
            break;
        case MP32:
            kumuluzVersion = "3.7.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-3.2";
            break;
        case MP30:
            kumuluzVersion = "3.6.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-3.0";
            break;
        case MP22:
            kumuluzVersion = "3.5.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-2.2";
            break;
        case MP21:
            kumuluzVersion = "3.2.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-2.1";
            break;
        case MP20:
            kumuluzVersion = "3.2.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-2.0";
            break;
        case MP14:
            kumuluzVersion = "2.6.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-1.4";
            break;
        case MP13:
            kumuluzVersion = "2.6.0";
            kumuluzeeConfigVersion = "1.3.0";
            artifactId = "kumuluzee-microProfile-1.3";
            break;
        case MP12:
            kumuluzVersion = "2.5.2";
            kumuluzeeConfigVersion = "1.1.1";
            artifactId = "kumuluzee-microProfile-1.2";
            break;
        default:
    }
    pomFile.addProperty("kumuluz.version", kumuluzVersion);
    pomFile.addProperty("kumuluzee-config-mp.version", kumuluzeeConfigVersion);
    pomFile.addProperty("kumuluzee-microprofile.version", artifactId);

}
 
Example 8
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {
    // Helidon needs jar packaging
    pomFile.setPackaging("jar");

    String packageName = model.getMaven().getGroupId() + '.' + model.getMaven().getArtifactId();
    pomFile.addProperty("package", packageName);

    String helidonVersion = "";
    String mpVersion = "";
    switch (model.getSpecification().getMicroProfileVersion()) {

        case NONE:
            break;
        case MP32:
            helidonVersion = "1.4.1";
            mpVersion = "3.2";
            break;
        case MP30:
            helidonVersion = "1.3.1";
            mpVersion = "3.0";
            break;
        case MP22:
            helidonVersion = "1.2.0";
            mpVersion = "2.2";
            break;
        case MP21:
            break;
        case MP20:
            break;
        case MP14:
            break;
        case MP13:
            break;
        case MP12:
            helidonVersion = "1.0.1";
            mpVersion = "1.2";
            break;
        default:
    }
    pomFile.addProperty("helidonVersion", helidonVersion);
    pomFile.addProperty("mpVersion", mpVersion);

}
 
Example 9
private Model createSingleModule(JessieModel model) {

        Model pomFile = new Model();
        pomFile.setModelVersion("4.0.0");

        pomFile.setGroupId(model.getMaven().getGroupId());
        pomFile.setArtifactId(model.getMaven().getArtifactId());
        pomFile.setVersion("1.0-SNAPSHOT");

        pomFile.setPackaging("war");

        addDependencies(pomFile, model);

        addJavaSEVersionProperties(pomFile, model);

        pomFile.addProperty("failOnMissingWebXml", "false");

        pomFile.addProperty("final.name", model.getMaven().getArtifactId());

        Build build = new Build();
        build.setFinalName(model.getMaven().getArtifactId());
        pomFile.setBuild(build);

        return pomFile;
    }
 
Example 10
private void addJavaSEVersionProperties(Model pomFile, JessieModel model) {

        JavaSEVersion seVersion = model.getSpecification().getJavaSEVersion();
        pomFile.addProperty("maven.compiler.source", seVersion.getCode());
        pomFile.addProperty("maven.compiler.target", seVersion.getCode());
    }