diff --git a/.github/workflows/run-regression-tests.yml b/.github/workflows/run-regression-tests.yml index 6738e29c..8b7fc7ee 100644 --- a/.github/workflows/run-regression-tests.yml +++ b/.github/workflows/run-regression-tests.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: runtime: [ linux, mac, windows ] - targetPlatform: [ 1Q2024 ] + targetPlatform: [ 3Q2024 ] include: - runtime: linux os: ubuntu-latest diff --git a/bundles/io.openliberty.tools.eclipse.lsp4e/META-INF/MANIFEST.MF b/bundles/io.openliberty.tools.eclipse.lsp4e/META-INF/MANIFEST.MF index a9de83b2..3cb123a5 100644 --- a/bundles/io.openliberty.tools.eclipse.lsp4e/META-INF/MANIFEST.MF +++ b/bundles/io.openliberty.tools.eclipse.lsp4e/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Version: 24.0.6.qualifier Bundle-Activator: io.openliberty.tools.eclipse.ls.plugin.LibertyToolsLSPlugin Bundle-ActivationPolicy: lazy Automatic-Module-Name: io.openliberty.tools.eclipse.lsp4e -Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: com.google.gson, org.eclipse.lsp4mp.jdt.core, org.eclipse.lsp4jakarta.jdt.core, diff --git a/bundles/io.openliberty.tools.eclipse.product/META-INF/MANIFEST.MF b/bundles/io.openliberty.tools.eclipse.product/META-INF/MANIFEST.MF index 8f37214b..e31799a1 100644 --- a/bundles/io.openliberty.tools.eclipse.product/META-INF/MANIFEST.MF +++ b/bundles/io.openliberty.tools.eclipse.product/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-Name: Liberty Tools Bundle-Vendor: Open Liberty Bundle-SymbolicName: io.openliberty.tools.eclipse.product;singleton:=true Bundle-Version: 24.0.6.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-RequiredExecutionEnvironment: JavaSE-21 Automatic-Module-Name: io.openliberty.tools.eclipse Bundle-ActivationPolicy: lazy diff --git a/bundles/io.openliberty.tools.eclipse.ui/META-INF/MANIFEST.MF b/bundles/io.openliberty.tools.eclipse.ui/META-INF/MANIFEST.MF index 3a104c9f..d830de2a 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/META-INF/MANIFEST.MF +++ b/bundles/io.openliberty.tools.eclipse.ui/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Export-Package: io.openliberty.tools.eclipse;x-friends:="io.openliberty.tools.ec io.openliberty.tools.eclipse.ui.preferences;x-friends:="io.openliberty.tools.eclipse.tests" Require-Bundle: org.eclipse.ui, org.eclipse.m2e.maven.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-RequiredExecutionEnvironment: JavaSE-21 Automatic-Module-Name: io.openliberty.tools.eclipse.ui Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.cdt.launch.ui, diff --git a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/LibertySourcePathComputer.java b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/LibertySourcePathComputer.java index 8bdb1d0f..3b88ed7f 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/LibertySourcePathComputer.java +++ b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/LibertySourcePathComputer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2023 IBM Corporation and others. +* Copyright (c) 2023, 2024 IBM Corporation and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -33,6 +33,7 @@ import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.IMavenProjectRegistry; +import org.gradle.tooling.BuildException; import org.gradle.tooling.GradleConnector; import org.gradle.tooling.ProjectConnection; import org.gradle.tooling.model.ExternalDependency; @@ -42,9 +43,16 @@ import io.openliberty.tools.eclipse.DevModeOperations; import io.openliberty.tools.eclipse.Project; import io.openliberty.tools.eclipse.ui.launch.StartTab; +import io.openliberty.tools.eclipse.utils.Utils; public class LibertySourcePathComputer implements ISourcePathComputerDelegate { + /** + * Gradle distribution that supports Java 21. + * Gradle version 8.4+ supports Java 21. + */ + private static String GRADLE_DISTRIBUTION_VERISION = "8.8"; + ArrayList unresolvedClasspathEntries; @Override @@ -132,12 +140,40 @@ private List getProjectDependencies(Project project) throws CoreExcept } } } else { - GradleConnector connector = GradleConnector.newConnector(); - connector.forProjectDirectory(project.getIProject().getLocation().toFile()); - ProjectConnection connection = connector.connect(); + ProjectConnection connection = getProjectGradleConnection(project.getIProject(), null); try { - EclipseProject eclipseProject = connection.getModel(EclipseProject.class); + EclipseProject eclipseProject = null; + + try { + eclipseProject = connection.getModel(EclipseProject.class); + } catch(BuildException e) { + // When using Eclipse IDE 2024-06, this exception could have been caused by the + // Gradle tooling API using a Gradle distribution that does not support Java 21. + // + // Per the GradleConnector documentation, if no Gradle version is defined for the + // build (Gradle wrapper properties file), the connection will use the tooling API's + // version as the Gradle version to run the build. + // Therefore, if a Gradle version is not defined for the build and given that the + // tooling version currently being used is 8.1.1, Gradle 8.1.1 + // is downloaded and used by the connector. Gradle 8.1.1 does not support Java 21, + // which causes runtime issues (Unsupported class file major version 65). + // As a workaround, specify a Java 21 compatible Gradle version that the tooling + // can use (i.e. 8.4+). Note that since it is preferable to use the default version + // provided by the tooling API, setting the version can be revised at a later time. + Throwable rootCause = Utils.findRootCause(e); + if (rootCause != null && rootCause instanceof IllegalArgumentException) { + String message = rootCause.getMessage(); + + if (message != null && message.contains("Unsupported class file major version 65")) { + connection = getProjectGradleConnection(project.getIProject(), GRADLE_DISTRIBUTION_VERISION); + eclipseProject = connection.getModel(EclipseProject.class); + } + } else { + throw e; + } + } + for (ExternalDependency externalDependency : eclipseProject.getClasspath()) { GradleModuleVersion gradleModuleVersion = externalDependency.getGradleModuleVersion(); @@ -156,6 +192,26 @@ private List getProjectDependencies(Project project) throws CoreExcept return projectDependencies; } + /** + * Returns a connection to the input gradle project. + * + * @param project The Gradle project. + * @param gradleDistVersion The gradle distribution version to be used by the + * Gradle API tooling. + * + * @return A connection to the input gradle project. + */ + private ProjectConnection getProjectGradleConnection(IProject project, String gradleDistVersion) { + GradleConnector connector = GradleConnector.newConnector(); + + if (gradleDistVersion != null) { + connector.useGradleVersion(gradleDistVersion); + } + + connector.forProjectDirectory(project.getLocation().toFile()); + return connector.connect(); + } + /** * Get project if found in local workspace based on artifact coordinates * diff --git a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/utils/Utils.java b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/utils/Utils.java index f7f6f917..b3b3ca14 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/utils/Utils.java +++ b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/utils/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2022 IBM Corporation and others. +* Copyright (c) 2022, 2024 IBM Corporation and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -253,4 +253,24 @@ public static String objectsToString(Object... objects) { return sb.toString(); } + + /** + * Returns the input throwable's root throwable cause. + * + * @param t The parent throwable. + * + * @return The input throwable's root throwable cause. + */ + public static Throwable findRootCause(Throwable t) { + if (t == null) { + return null; + } + + Throwable cause = t; + while (cause.getCause() != null && cause.getCause() != cause) { + cause = cause.getCause(); + } + + return cause; + } } diff --git a/ci/jenkins/release b/ci/jenkins/release index 7a30f3a6..a78a2aef 100644 --- a/ci/jenkins/release +++ b/ci/jenkins/release @@ -2,7 +2,7 @@ pipeline { agent any tools { - jdk 'java17-semeru' + jdk 'jdk-semeru-21.0.3' maven 'maven-3.9.6' } diff --git a/ci/jenkins/run-tests b/ci/jenkins/run-tests index 1a2e333b..57db5617 100644 --- a/ci/jenkins/run-tests +++ b/ci/jenkins/run-tests @@ -2,7 +2,7 @@ pipeline { agent any tools { - jdk 'java17-semeru' + jdk 'jdk-semeru-21.0.3' xvfb 'gui-test' maven 'maven-3.9.6' gradle 'gradle-7.6.1' diff --git a/ci/scans/dependency-only-mend-pom.xml b/ci/scans/dependency-only-mend-pom.xml index 32cbb5ff..c59061d0 100644 --- a/ci/scans/dependency-only-mend-pom.xml +++ b/ci/scans/dependency-only-mend-pom.xml @@ -1,6 +1,6 @@ + com.google.code.gson @@ -117,12 +117,12 @@ OTHER REFERENCES: https://projects.eclipse.org/projects/eclipse.platform/develo org.eclipse.jdt org.eclipse.jdt - 3.19.300 + 3.19.400 org.eclipse.jdt org.eclipse.jdt.core - 3.36.0 + 3.37.0 org.eclipse.jdt @@ -132,105 +132,105 @@ OTHER REFERENCES: https://projects.eclipse.org/projects/eclipse.platform/develo org.eclipse.jdt org.eclipse.jdt.debug.ui - 3.13.200 + 3.13.300 org.eclipse.jdt org.eclipse.jdt.launching - 3.21.0 + 3.21.100 org.eclipse.jdt org.eclipse.jdt.ui - 3.31.0 + 3.32.0 org.eclipse.platform org.eclipse.jface.text - 3.24.200 + 3.25.0 org.eclipse.lsp4j org.eclipse.lsp4j - 0.21.1 + 0.22.0 org.eclipse.lsp4j org.eclipse.lsp4j.jsonrpc - 0.21.1 + 0.22.0 org.eclipse.platform org.eclipse.core.commands - 3.11.200 + 3.12.0 org.eclipse.platform org.eclipse.core.expressions - 3.9.200 + 3.9.300 org.eclipse.platform org.eclipse.core.jobs - 3.15.100 + 3.15.200 org.eclipse.platform org.eclipse.core.resources - 3.20.0 + 3.20.100 org.eclipse.platform org.eclipse.core.runtime - 3.30.0 + 3.31.0 org.eclipse.platform org.eclipse.debug.core - 3.21.200 + 3.21.300 org.eclipse.platform org.eclipse.debug.ui - 3.18.200 + 3.18.300 org.eclipse.platform org.eclipse.equinox.preferences - 3.10.400 + 3.11.0 org.eclipse.platform org.eclipse.osgi - 3.18.600 + 3.19.0 org.eclipse.platform org.eclipse.swt - 3.124.200 + 3.125.0 org.eclipse.platform org.eclipse.ui - 3.205.0 + 3.205.100 org.eclipse.platform org.eclipse.ui.ide - 3.22.0 + 3.22.100 org.eclipse.platform org.eclipse.ui.editors - 3.17.100 + 3.17.200 org.eclipse.platform org.eclipse.ui.workbench - 3.131.0 + 3.131.100 diff --git a/docs/user-guide.md b/docs/user-guide.md index 0bb0be21..21414216 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -12,7 +12,7 @@ This guide provides detailed instructions on how to use Liberty Tools for the Ec * [Accessing Liberty Tools Operations](#accessing-liberty-tools-operations) + [Using the Liberty dashboard view](#using-the-liberty-dashboard-view) + [Using the Project Explorer view](#using-the-project-explorer-view) - * [Running your application on Liberty using dev mode](#running-your-application-on-liberty-using-dev-mode-1) + * [Running your application on Liberty using dev mode](#running-your-application-on-liberty-using-dev-mode) + [Start](#start) + [Start with Configuration](#start-with-configuration) + [Start in container](#start-in-container) @@ -46,11 +46,12 @@ This guide provides detailed instructions on how to use Liberty Tools for the Ec | 23.0.12 | 2023-09 - Eclipse v4.29 | | 24.0.3 | 2023-12 - Eclipse v4.30 | | 24.0.6 | 2024-03 - Eclipse v4.31 | +| 24.0.9 | 2024-06 - Eclipse v4.32 | **NOTE:** Tested with each of the `Eclipse IDE for Enterprise Java and Web Developers` and `Eclipse IDE for Java Developers` packages -2. **Java:** The Eclipse IDE itself requires Java 17. However, the application runtime [can be run with other versions of Java](#start-with-configuration), as long as they are supported by Liberty. +2. **Java:** The Eclipse IDE itself requires Java 21. However, the application runtime [can be run with other versions of Java](#start-with-configuration), as long as they are supported by Liberty. 3. [**Liberty Tools**](installation.md) @@ -64,7 +65,7 @@ This guide provides detailed instructions on how to use Liberty Tools for the Ec - Liberty Maven Plugin -> 3.7.1 - - Liberty Gradle Plugin -> 3.5.1 + - Liberty Gradle Plugin -> 3.8 ### Maven and Gradle @@ -83,7 +84,7 @@ Since Liberty dev mode uses the Liberty Maven or Gradle plugins to manage a Mave - Set the Maven/Gradle installation to use. - click on **Apply and Close** to save your changes. -3. If a Maven/Gradle installation is still not found, Liberty Tools looks at the PATH environment variable for install locations. See the instructions in [the following section](#Docker) which can also apply to finding Maven or Gradle executables. +3. If a Maven/Gradle installation is still not found, Liberty Tools looks at the PATH environment variable for install locations. See the instructions in [the following section](#docker) which can also apply to finding Maven or Gradle executables. ### Docker @@ -310,7 +311,7 @@ The Gradle Eclipse plugins (Buildship) run a simple Gradle build upon import (** If this build does not complete successfully, the Liberty Tools function might not work correctly. -For example, if your project uses a Gradle wrapper at a Gradle version less than v7.3, it does not support Java 17 per [matrix](https://docs.gradle.org/current/userguide/compatibility.html), but the Java 17+ workspace JRE is required for running Liberty Tools. +For example, if your project uses a Gradle wrapper at a Gradle version less than v8.4, it does not support Java 21 per [matrix](https://docs.gradle.org/current/userguide/compatibility.html), but the Java 21+ workspace JRE is required for running Liberty Tools. One approach to resolve this incompatibility is to configure the preference at: **Preferences -> Gradle -> Java home** to refer to a Java installation that is compatible with the level of Gradle in your `gradlew` wrapper. diff --git a/pom.xml b/pom.xml index b3f937c8..e9dcf851 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ - 1Q2024 + 3Q2024 @@ -109,7 +109,7 @@ tycho-compiler-plugin ${tycho.version} - 17 + 21 @@ -191,7 +191,7 @@ target-platform-configuration ${tycho.version} - JavaSE-17 + JavaSE-21 io.openliberty.tools.eclipse diff --git a/releng/io.openliberty.tools.update/category.xml b/releng/io.openliberty.tools.update/category.xml index 7d8cfaaa..2f505818 100644 --- a/releng/io.openliberty.tools.update/category.xml +++ b/releng/io.openliberty.tools.update/category.xml @@ -1,6 +1,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + net.bytebuddy + byte-buddy-agent + 1.14.18 + jar + + + net.bytebuddy + byte-buddy + 1.14.18 + jar + + + org.mockito + mockito-core + 5.12.0 + jar + + + org.mockito + mockito-junit-jupiter + 5.12.0 + jar + + + org.objenesis + objenesis + 3.4 + jar + + + + + diff --git a/tests/META-INF/MANIFEST.MF b/tests/META-INF/MANIFEST.MF index dce83113..94ad1217 100644 --- a/tests/META-INF/MANIFEST.MF +++ b/tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tests Plug-in Bundle-SymbolicName: io.openliberty.tools.eclipse.tests Bundle-Version: 24.0.6.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: junit-jupiter-api;bundle-version="[5.8.0,6.0.0)", org.eclipse.ui, org.hamcrest.library;bundle-version="[1.3.0,2.2)" diff --git a/tests/pom.xml b/tests/pom.xml index 5f4127b7..8eb27fa1 100755 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -1,6 +1,6 @@ + + -XstartOnFirstThread + -Dnet.bytebuddy.experimental=true + alphabetical diff --git a/tests/resources/applications/gradle/liberty-gradle-test-app/build.gradle b/tests/resources/applications/gradle/liberty-gradle-test-app/build.gradle index 6bb55d97..360a9ba6 100644 --- a/tests/resources/applications/gradle/liberty-gradle-test-app/build.gradle +++ b/tests/resources/applications/gradle/liberty-gradle-test-app/build.gradle @@ -4,8 +4,8 @@ apply plugin: 'war' version '0.0.1-SNAPSHOT' group 'liberty.gradle.test.app' -sourceCompatibility = 11 -targetCompatibility = 11 +sourceCompatibility = 21 +targetCompatibility = 21 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -16,7 +16,7 @@ buildscript { mavenLocal() } dependencies { - classpath 'io.openliberty.tools:liberty-gradle-plugin:3.6.2' + classpath 'io.openliberty.tools:liberty-gradle-plugin:3.8.3' } } diff --git a/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/build.gradle b/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/build.gradle index 023a636e..d2851c1d 100644 --- a/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/build.gradle +++ b/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/build.gradle @@ -4,8 +4,8 @@ apply plugin: 'war' version '0.0.1-SNAPSHOT' group 'liberty.gradle.test.app' -sourceCompatibility = 11 -targetCompatibility = 11 +sourceCompatibility = 21 +targetCompatibility = 21 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -15,7 +15,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'io.openliberty.tools:liberty-gradle-plugin:3.6.2' + classpath 'io.openliberty.tools:liberty-gradle-plugin:3.8.3' } } diff --git a/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties b/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties index aa991fce..0d184210 100644 --- a/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties +++ b/tests/resources/applications/gradle/liberty-gradle-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/tests/resources/applications/maven/liberty-maven-test-app/pom.xml b/tests/resources/applications/maven/liberty-maven-test-app/pom.xml index 3405976d..c448725a 100644 --- a/tests/resources/applications/maven/liberty-maven-test-app/pom.xml +++ b/tests/resources/applications/maven/liberty-maven-test-app/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 test liberty.maven.test.app @@ -23,8 +24,8 @@ UTF-8 UTF-8 - 11 - 11 + 21 + 21 minify,runnable @@ -70,7 +71,7 @@ io.openliberty.tools liberty-maven-plugin - 3.7.1 + 3.10.3 120 true diff --git a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.jar b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.jar index bf82ff01..cb28b0e3 100644 Binary files a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.jar and b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.jar differ diff --git a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.properties b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.properties index 30052152..346d645f 100644 --- a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.properties +++ b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/.mvn/wrapper/maven-wrapper.properties @@ -6,7 +6,7 @@ # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw index b7f06462..8d937f4c 100755 --- a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw +++ b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Apache Maven Wrapper startup batch script, version 3.1.1 +# Apache Maven Wrapper startup batch script, version 3.2.0 # # Required ENV vars: # ------------------ @@ -53,7 +53,7 @@ fi cygwin=false; darwin=false; mingw=false -case "`uname`" in +case "$(uname)" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true @@ -61,7 +61,7 @@ case "`uname`" in # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then - JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME else JAVA_HOME="/Library/Java/Home"; export JAVA_HOME fi @@ -71,38 +71,38 @@ esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` + JAVA_HOME=$(java-config --jre-home) fi fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" fi if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" else - javaExecutable="`readlink -f \"$javaExecutable\"`" + javaExecutable="$(readlink -f "\"$javaExecutable\"")" fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') JAVA_HOME="$javaHome" export JAVA_HOME fi @@ -118,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" fi fi @@ -150,108 +150,99 @@ find_maven_basedir() { fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` + wdir=$(cd "$wdir/.." || exit 1; pwd) fi # end of workaround done - printf '%s' "$(cd "$basedir"; pwd)" + printf '%s' "$(cd "$basedir" || exit 1; pwd)" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" fi } -BASE_DIR=$(find_maven_basedir "$(dirname $0)") +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") if [ -z "$BASE_DIR" ]; then exit 1; fi MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi +log "$MAVEN_PROJECTBASEDIR" ########################################################################################## # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central # This allows using the maven wrapper in projects that prohibit checking in binary data. ########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi + log "Couldn't find $wrapperJarPath, downloading it ..." + if [ -n "$MVNW_REPOURL" ]; then - wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" else - wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;; + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $wrapperUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") fi if command -v wget > /dev/null; then - QUIET="--quiet" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - QUIET="" - fi + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" else - wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" elif command -v curl > /dev/null; then - QUIET="--silent" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - QUIET="" - fi + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" else - curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" # For Cygwin, switch paths to Windows format before running javac if $cygwin; then - javaSource=`cygpath --path --windows "$javaSource"` - javaClass=`cygpath --path --windows "$javaClass"` + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") fi if [ -e "$javaSource" ]; then if [ ! -e "$javaClass" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class + log " - Compiling MavenWrapperDownloader.java ..." ("$JAVA_HOME/bin/javac" "$javaSource") fi if [ -e "$javaClass" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" fi fi fi @@ -260,25 +251,55 @@ fi # End of extension ########################################################################################## +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") fi # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +# shellcheck disable=SC2086 # safe args exec "$JAVACMD" \ $MAVEN_OPTS \ $MAVEN_DEBUG_OPTS \ diff --git a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw.cmd b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw.cmd index 474c9d6b..c4586b56 100644 --- a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw.cmd +++ b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/mvnw.cmd @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.1.1 +@REM Apache Maven Wrapper startup batch script, version 3.2.0 @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -119,7 +119,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B @@ -133,7 +133,7 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... @@ -153,6 +153,24 @@ if exist %WRAPPER_JAR% ( ) @REM End of extension +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + @REM Provide a "standardized" way to retrieve the CLI args that will @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* diff --git a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/pom.xml b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/pom.xml index 1781410f..c48e625d 100644 --- a/tests/resources/applications/maven/liberty-maven-test-wrapper-app/pom.xml +++ b/tests/resources/applications/maven/liberty-maven-test-wrapper-app/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 test liberty.maven.test.wrapper.app @@ -23,8 +24,8 @@ UTF-8 UTF-8 - 17 - 17 + 21 + 21 minify,runnable @@ -63,7 +64,7 @@ io.openliberty.tools liberty-maven-plugin - 3.7.1 + 3.10.3 120 true diff --git a/tests/resources/applications/maven/maven-multi-module/typeJ/jar/pom.xml b/tests/resources/applications/maven/maven-multi-module/typeJ/jar/pom.xml index 9085c5cc..3dcd6032 100644 --- a/tests/resources/applications/maven/maven-multi-module/typeJ/jar/pom.xml +++ b/tests/resources/applications/maven/maven-multi-module/typeJ/jar/pom.xml @@ -1,4 +1,16 @@ - + + + /dev/null; then - QUIET="--quiet" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - QUIET="" - fi + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" else - wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" elif command -v curl > /dev/null; then - QUIET="--silent" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - QUIET="" - fi + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" else - curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" # For Cygwin, switch paths to Windows format before running javac if $cygwin; then - javaSource=`cygpath --path --windows "$javaSource"` - javaClass=`cygpath --path --windows "$javaClass"` + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") fi if [ -e "$javaSource" ]; then if [ ! -e "$javaClass" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class + log " - Compiling MavenWrapperDownloader.java ..." ("$JAVA_HOME/bin/javac" "$javaSource") fi if [ -e "$javaClass" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" fi fi fi @@ -260,25 +251,55 @@ fi # End of extension ########################################################################################## +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") fi # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +# shellcheck disable=SC2086 # safe args exec "$JAVACMD" \ $MAVEN_OPTS \ $MAVEN_DEBUG_OPTS \ diff --git a/tests/resources/applications/maven/maven-multi-module/typeJ/pom/mvnw.cmd b/tests/resources/applications/maven/maven-multi-module/typeJ/pom/mvnw.cmd index 474c9d6b..c4586b56 100644 --- a/tests/resources/applications/maven/maven-multi-module/typeJ/pom/mvnw.cmd +++ b/tests/resources/applications/maven/maven-multi-module/typeJ/pom/mvnw.cmd @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.1.1 +@REM Apache Maven Wrapper startup batch script, version 3.2.0 @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -119,7 +119,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B @@ -133,7 +133,7 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... @@ -153,6 +153,24 @@ if exist %WRAPPER_JAR% ( ) @REM End of extension +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + @REM Provide a "standardized" way to retrieve the CLI args that will @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* diff --git a/tests/resources/applications/maven/maven-multi-module/typeJ/pom/pom.xml b/tests/resources/applications/maven/maven-multi-module/typeJ/pom/pom.xml index 43dc83cd..0b82d850 100644 --- a/tests/resources/applications/maven/maven-multi-module/typeJ/pom/pom.xml +++ b/tests/resources/applications/maven/maven-multi-module/typeJ/pom/pom.xml @@ -1,4 +1,16 @@ - + + + + &2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - printf '%s' "$(cd "$basedir"; pwd)" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=$(find_maven_basedir "$(dirname $0)") -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" - else - wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $wrapperUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - QUIET="--quiet" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - QUIET="" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" - else - wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" - fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" - elif command -v curl > /dev/null; then - QUIET="--silent" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - QUIET="" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L - else - curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L - fi - [ $? -eq 0 ] || rm -f "$wrapperJarPath" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaSource=`cygpath --path --windows "$javaSource"` - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaSource" ]; then - if [ ! -e "$javaClass" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaSource") - fi - if [ -e "$javaClass" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/tests/resources/applications/maven/non-dflt-server-xml-path/mvnw.cmd b/tests/resources/applications/maven/non-dflt-server-xml-path/mvnw.cmd deleted file mode 100644 index 474c9d6b..00000000 --- a/tests/resources/applications/maven/non-dflt-server-xml-path/mvnw.cmd +++ /dev/null @@ -1,187 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.1.1 -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %WRAPPER_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% diff --git a/tests/resources/applications/maven/non-dflt-server-xml-path/pom.xml b/tests/resources/applications/maven/non-dflt-server-xml-path/pom.xml index fba592ff..458966f4 100644 --- a/tests/resources/applications/maven/non-dflt-server-xml-path/pom.xml +++ b/tests/resources/applications/maven/non-dflt-server-xml-path/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 test non.dflt.server.xml.path @@ -23,8 +24,8 @@ UTF-8 UTF-8 - 11 - 11 + 21 + 21 minify,runnable @@ -63,7 +64,7 @@ io.openliberty.tools liberty-maven-plugin - 3.7.1 + 3.10.3 120 src/main/liberty/config/my.xml diff --git a/tests/resources/applications/maven/shared-lib/pom.xml b/tests/resources/applications/maven/shared-lib/pom.xml index 6078669e..81070b14 100644 --- a/tests/resources/applications/maven/shared-lib/pom.xml +++ b/tests/resources/applications/maven/shared-lib/pom.xml @@ -1,4 +1,16 @@ - + + folders) * @throws CoreException */ public static void importGradleApplications(ArrayList projectsToInstall) throws Exception { - + // When using Eclipse IDE 2024-06, this exception could have been caused by the + // Gradle tooling API using a Gradle distribution that does not support Java 21. + // + // Buildship 3.1.9 uses org.gradle.toolingapi 8.1.1. If no Gradle version is defined for the + // build (Gradle wrapper properties file), the connection will use the tooling API's + // version as the Gradle version to run the build. + // Therefore, if a Gradle version is not defined for the build and given that the + // tooling version currently being used is 8.1.1, Gradle 8.1.1 + // is downloaded and used by the Gradle build. Gradle 8.1.1 does not support Java 21. + // This causes runtime issues during the synchronization step (Unsupported class file major + // version 65), which are not reported back to the caller. + // To workaround this issue, specify a Java 21 compatible Gradle version that the + // tooling can use (i.e. 8.4+). Note that since it is preferable to use the default version + // provided by the tooling API, setting the version can be revised at a later time. for (File projectFile : projectsToInstall) { IPath projectLocation = org.eclipse.core.runtime.Path .fromOSString(Paths.get(projectFile.getPath()).toAbsolutePath().toString()); - BuildConfiguration configuration = BuildConfiguration.forRootProjectDirectory(projectLocation.toFile()).build(); + BuildConfiguration configuration = BuildConfiguration.forRootProjectDirectory(projectLocation.toFile()) + .gradleDistribution(GradleDistribution.forVersion(GRADLE_DISTRIBUTION_VERISION)) + .overrideWorkspaceConfiguration(true).build(); GradleWorkspace workspace = GradleCore.getWorkspace(); GradleBuild newBuild = workspace.createBuild(configuration); newBuild.synchronize(new NullProgressMonitor());