Skip to content

Commit

Permalink
[Runtime] Embed Maven 3.9.1
Browse files Browse the repository at this point in the history
Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Signed-off-by: Yan Zhang <yanzh@microsoft.com>
  • Loading branch information
Eskibear and HannesWell committed Mar 29, 2023
1 parent 43bba83 commit f5e9cdc
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 48 deletions.
14 changes: 11 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Eclipse m2e - Release notes

## 2.3.0

* 📅 Release Date: _expected_ May 2023

### Embedded and use Maven 3.9.1

Updated the embedded Maven from version 3.8.7 to 3.9.1; [Maven 3.9.1 Release Notes](https://maven.apache.org/docs/3.9.1/release-notes.html).

## 2.2.1

* 📅 Release Date: 7th March 2023
Expand All @@ -21,7 +29,7 @@ Previously, to participate in the incremental maven build it was necessary to
This often leads to a poor user experience and we think that users are adding mojos on purpose because they perform valuable tasks.

Because of this, M2E now automatically enables the execution of mojos if there is no mapping configured. In case you want to change this there is a new configuration option to control the behavior:
![grafik](https://user-images.githubusercontent.com/1331477/211298610-0fa92418-246a-4377-913a-60d02d63013b.png)
![grafik](https://user-images.githubusercontent.com/1331477/211298610-0fa92418-246a-4377-913a-60d02d63013b.png)

### Updated Dependency Editor

Expand All @@ -41,7 +49,7 @@ https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.

### Configuration of Maven Execution JRE

In the past, the project's build JRE was also used by default to execute Maven itself.
In the past, the project's build JRE was also used by default to execute Maven itself.
Now the default Java version for executing Maven is determined from the configuration of the `maven-enforcer-plugin` rule [`requireJavaVersion`](https://maven.apache.org/enforcer/enforcer-rules/requireJavaVersion.html) when creating or updating the Maven configuration. This value is no longer considered for configuring the project's build JRE.
In case this plugin configuration is not found, M2E falls back to either the project's build JRE or the workspace's default JRE.

Expand Down Expand Up @@ -70,7 +78,7 @@ The connector for the `bnd-maven-plugin` and `maven-bundle-plugin`, which is inc

The M2E Maven-Console now also supports tracking of so called _polyglot_ Maven-projects. Those are projects that don't have a standard `pom.xml` and whose Maven-model is instead created from another source. One prominent example in the Eclipse world are Eclipse-PDE projects that are build with Tycho(-pomless).

Due to this new support, polyglot Maven projects now also benefit from the
Due to this new support, polyglot Maven projects now also benefit from the
[Improved links to JUnit test-reports and project file in the Console](https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#improved-links-to-junit-test-reports-and-project-pomxml-in-the-console-of-a-maven-build)
as well as the capability to
[Automatically launch and attach Remote-Application-Debugger when Maven plug-in starts a forked JVM that waits for a debugger](https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#automatically-launch-and-attach-remote-application-debugger-when-maven-plug-in-starts-a-forked-jvm-that-waits-for-a-debugger) introduced in previous releases.
Expand Down
16 changes: 6 additions & 10 deletions m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
</parent>

<artifactId>org.eclipse.m2e.maven.runtime</artifactId>
<version>3.8.701-SNAPSHOT</version>
<version>3.9.100-SNAPSHOT</version>
<packaging>jar</packaging>

<name>M2E Embedded Maven Runtime (includes Incubating components)</name>

<properties>
<!-- maven core version -->
<maven-core.version>3.8.7</maven-core.version>
<maven-core.version>3.9.1</maven-core.version>
<!-- NOTE: When maven-core.version changes, this may impact the versions of the maven-resolver-*
jars that export the org.eclipse.aether.* packages in the org.eclipse.m2e.maven.runtime
bundle. So make sure the following variable has the value of the maven-resolver-* jars
https://bugs.eclipse.org/bugs/show_bug.cgi?id=529540 -->
<maven-resolver.version>1.6.3</maven-resolver.version>
<maven-resolver.version>1.9.7</maven-resolver.version>
<!-- below are m2e-specific addons -->
<plexus-build-api.version>0.0.7</plexus-build-api.version>
<okhttp-connector.version>0.17.8</okhttp-connector.version>
Expand All @@ -52,10 +52,6 @@
<groupId>org.checkerframework</groupId>
<artifactId>checker-compat-qual</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -156,8 +152,8 @@
<configuration>
<bnd><![CDATA[
# When launching a Maven build using this embedded runtime, we want the embedded SLF4J logger binding to be used.
# However when the this Maven runtime is used within the Eclipse-IDE(-JVM) we don't want it to use the embedded SLF4J-binding
# but instead use the SLF4J-binding provided by the Eclipse runtime. This is achived by making the embedded SLF4J-binding invisible
# However when the this Maven runtime is used within the Eclipse-IDE(-JVM) we don't want it to use the embedded SLF4J-binding
# but instead use the SLF4J-binding provided by the Eclipse runtime. This is achived by making the embedded SLF4J-binding invisible
# for OSGi, by simply NOT placing the binding's jar on the Bundle-ClassPath.
slf4jBinding=maven-slf4j-provider-${maven-core.version}.jar
M2E-SLF4JBinding=jars/${slf4jBinding}
Expand Down Expand Up @@ -185,7 +181,7 @@
Require-Bundle: \
com.google.guava
]]></bnd>
<!-- All direct dependencies specified as Require-Bundle or Import-package are added to the classpath of a launched
<!-- All direct dependencies specified as Require-Bundle or Import-package are added to the classpath of a launched
Maven-Build-JVM. See MavenEmbeddedRuntime for details. -->
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.0.0</version>
<configuration>
<trimStackTrace>true</trimStackTrace>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
</project>
1 change: 1 addition & 0 deletions org.eclipse.m2e.core/forceQualifierUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# To force a version qualifier update add the bug here
Update build-qualifier because the compiled byte-code has changed, probably due to newer JDK minor version used in the CI
Last update: Wed Mar 22 15:45:13 CST 2023
2 changes: 1 addition & 1 deletion org.eclipse.m2e.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.m2e.feature"
label="%featureName"
version="2.2.2.qualifier"
version="2.3.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.m2e.core"
license-feature="org.eclipse.license"
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.m2e.launching/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.m2e.launching;singleton:=true
Bundle-Version: 2.0.400.qualifier
Bundle-Version: 2.0.500.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.variables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.eclipse.m2e.internal.launch;

import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayDeque;
Expand Down Expand Up @@ -109,7 +110,7 @@ private static record ProjectReference(IProject project, MavenProjectBuildData b

private ProjectReference mavenProject;

private final Deque<IRegion> projectDefinitionLines = new ArrayDeque<>(2);
private final Deque<IRegion> projectDefinitionLines = new ArrayDeque<>(3);

private final List<int[]> removedLineLocations = new ArrayList<>();

Expand Down Expand Up @@ -190,42 +191,47 @@ private boolean isMavenProcess(ILaunchConfiguration launchConfiguration) {

private static final int VERSION = 1;

private static final Pattern FROM_FILE_LINE = Pattern.compile("^\\[INFO\\] +from ");

private static final Pattern PACKAGING_TYPE_LINE = Pattern.compile("^\\[INFO\\] -+\\[ [\\w\\-\\. ]+ \\]-+$");

private String getText(IRegion lineRegion) throws BadLocationException {
removedLineLocations.clear();
String line0 = getLineText(lineRegion, removedLineLocations);

if(projectDefinitionLines.size() < 2) {
if(projectDefinitionLines.size() < 3) {
projectDefinitionLines.add(lineRegion);
return line0;
}
// Read groupId, artifactId and version from a sequence like the following lines:
// [INFO] -----------< org.eclipse.m2e:org.eclipse.m2e.maven.runtime >------------
// [INFO] Building M2E Embedded Maven Runtime (includes Incubating components) 1.18.2-SNAPSHOT [4/5]
// [INFO] from pom.xml
// [INFO] ---------------------------[ eclipse-plugin ]---------------------------

if(PACKAGING_TYPE_LINE.matcher(line0).matches()) {
Iterator<IRegion> previousLines = projectDefinitionLines.descendingIterator();

IRegion line1Region = previousLines.next();
String line1 = getLineText(line1Region, null);

Matcher vMatcher = VERSION_LINE.matcher(line1);
if(vMatcher.matches()) {
String version = vMatcher.group(VERSION);

IRegion line2Region = previousLines.next();
List<int[]> removedLine2Locations = new ArrayList<>();
String line2 = getLineText(line2Region, removedLine2Locations);
Matcher gaMatcher = GROUP_ARTIFACT_LINE.matcher(line2);
if(gaMatcher.matches()) {
String groupId = gaMatcher.group(GROUP_ID);
String artifactId = gaMatcher.group(ARTIFACT_ID);

mavenProject = getProject(groupId, artifactId, version);
if(mavenProject != null) {
addProjectLink(line2Region, gaMatcher, GROUP_ID, ARTIFACT_ID, removedLine2Locations);
String line1 = getLineText(previousLines.next(), null);
if(FROM_FILE_LINE.matcher(line1).find()) {

String line2 = getLineText(previousLines.next(), null);
Matcher vMatcher = VERSION_LINE.matcher(line2);
if(vMatcher.matches()) {
String version = vMatcher.group(VERSION);

IRegion line3Region = previousLines.next();
List<int[]> removedLine3Locations = new ArrayList<>();
String line3 = getLineText(line3Region, removedLine3Locations);
Matcher gaMatcher = GROUP_ARTIFACT_LINE.matcher(line3);
if(gaMatcher.matches()) {
String groupId = gaMatcher.group(GROUP_ID);
String artifactId = gaMatcher.group(ARTIFACT_ID);

mavenProject = getProject(groupId, artifactId, version);
if(mavenProject != null) {
addProjectLink(line3Region, gaMatcher, GROUP_ID, ARTIFACT_ID, removedLine3Locations);
}
}
}
}
Expand Down Expand Up @@ -265,9 +271,9 @@ private ProjectReference getProject(String groupId, String artifactId, String ve
if(buildProject == null) {
return null;
}
Optional<IProject> project = Arrays
.stream(
ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(buildProject.projectBasedir.toUri()))
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
URI basedirURI = buildProject.projectBasedir.toUri();
Optional<IProject> project = Arrays.stream(wsRoot.findContainersForLocationURI(basedirURI))
.filter(IProject.class::isInstance).map(IProject.class::cast).findFirst();
//if project is absent, the project build in Maven is not in the workspace
return project.isPresent() ? new ProjectReference(project.get(), buildProject) : null;
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.m2e.mavenarchiver/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: m2e connector for the mavenarchiver and pom properties
Bundle-SymbolicName: org.eclipse.m2e.mavenarchiver;singleton:=true
Bundle-Version: 2.0.300.qualifier
Bundle-Version: 2.0.400.qualifier
Bundle-Vendor: Eclipse.org - m2e
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.eclipse.m2e.mavenarchiver.internal;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -466,7 +465,7 @@ private void reflectManifestGeneration(IMavenProjectFacade facade, MojoExecution
}

private void writeManifest(File manifestFile, Object manifest) throws UnsupportedEncodingException,
FileNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException {
Method write = getWriteMethod(manifest);
if (write != null) {
try (PrintWriter printWriter = new PrintWriter(
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.m2e.sdk.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.m2e.sdk.feature"
label="%featureName"
version="2.2.2.qualifier"
version="2.3.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
<module>org.eclipse.m2e.profiles.core.tests</module>
<module>org.eclipse.m2e.apt.tests</module>
<module>org.eclipse.m2e.pde.connector.tests</module>

<!-- products -->
<module>products</module>

<!-- UI/Integration tests -->
<module>org.eclipse.m2e.rcptt.tests</module>
</modules>
Expand All @@ -107,7 +107,7 @@
<dependency>
<groupId>org.eclipse.m2e</groupId>
<artifactId>org.eclipse.m2e.maven.runtime</artifactId>
<version>3.8.701-SNAPSHOT</version>
<version>3.9.100-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down

0 comments on commit f5e9cdc

Please sign in to comment.