Skip to content

Bump org.codehaus.plexus:plexus from 19 to 20 #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Plexus Language

![Build Status](https://github.com/codehaus-plexus/plexus-languages/workflows/GitHub%20CI/badge.svg)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/codehaus-plexus/plexus-languages/maven.yml?branch=master)
[![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/org/codehaus/plexus/plexus-languages/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/codehaus/plexus/plexus-languages/README.md)

Plexus Languages:

* [![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-languages.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-languages)
* [![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-languages.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-languages)

Plexus Java:

* [![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-java.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-java)
* [![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-java.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-java)

16 changes: 9 additions & 7 deletions plexus-java/src/site/markdown/locationmanager.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The plexus-java library is created to have a solution for common activities, so this business logic doesn't have to be maintained at multiple places. The first provided feature was the `LocationManager` to analyze module desciptors and to decide which jars should end up on the modulepath and which on the classpath. The name was based on the [javax.tools.JavaFileManager.Location]. (https://docs.oracle.com/javase/10/docs/api/javax/tools/JavaFileManager.Location.html)

The library requires Java 8 to run, but contains optimized code for Java 9. By requiring Java 8 it was much easier to embed this library in several other projects.
The library requires Java 8 to run, but contains optimized code for Java 9. By requiring Java 8 it was much easier to embed this library in several other projects.

This jar is a multi release jar (aka MRJAR), because it contains 2 implementations for the `BinaryModuleInfoParser`. If the Java runtime is 9 or above, the `java.lang.module.ModuleDescriptor` is used to read the `module-info.class`. If the runtime is Java 8, then ASM is used to read the module descriptor.

Expand All @@ -18,13 +18,13 @@ There are 3 ways to create a `ResolvePathsRequest`:

- `ResolvePathsRequest.ofStrings(Collection<String>)`

As argument you pass all the archives and/or outputDirectories specified to build the project.
As argument you pass all the archives and/or outputDirectories specified to build the project.

Additional methods are:

- `setAdditionalModules`, in case the consumer wants to use `--add-modules`

- `setIncludeAllProviders`, in general would only be used at runtime, not during compile or test. In case `uses` is used, all modules with matching `provides` are added as well.
- `setIncludeAllProviders`, in general would only be used at runtime, not during compile or test. In case `uses` is used, all modules with matching `provides` are added as well.

- `setJdkHome`, should point to Java 9 or above in case the runtime of this library is Java 8

Expand All @@ -37,9 +37,9 @@ If there's a `mainModuleDescriptor`, extract a `JavaModuleDescriptor` of it. Thi
All pathElements of `ResolvePathsRequest.ofT` are transformed to Path instances. For every element the name will be resolved in the following order:

1. Module descriptor: verify if the jar or the directory contains `module-info.class`. If so, the its descriptor is transformed to a `JavaModuleDescriptor`, where its ModuleNameSource is marked as `ModuleNameSource.MODULEDESCRIPTOR`
2. Manifest: verify if the jar or directory has a `META-INF/MANIFEST.MF` and if it contains the `Automatic-Module-Name` attribute. If so, an automatic `JavaModuleDescriptor` is created, where its ModuleNameSource is marked as `ModuleNameSource.MANIFEST`.

2. Manifest: verify if the jar or directory has a `META-INF/MANIFEST.MF` and if it contains the `Automatic-Module-Name` attribute. If so, an automatic `JavaModuleDescriptor` is created, where its ModuleNameSource is marked as `ModuleNameSource.MANIFEST`.

3. Filename: try to extract the module name based on the filename. If the filename could be transformed to a module name (which is not always the case), an automatic `JavaModuleDescriptor` is created, where its ModuleNameSource is marked as `ModuleNameSource.FILENAME`.

When there's an `IOException` with one of the pathElements, the exception is stored in the `ResolvePathsResult.pathExceptions` so the consumer can handle them separately.
Expand All @@ -48,7 +48,7 @@ The result are a couple of Maps:

* module name to `ModuleNameSource`

* module name to `JavaModuleDescriptor`
* module name to `JavaModuleDescriptor`

# Phase 2: Resolve

Expand All @@ -57,6 +57,7 @@ This contains recursive code and ensures that required modules are only evaluate
All these pathElements must be placed on the modulepath, all other pathElements will be marked for the classPath.

# Result

All results will be stored in a `ResolvePathsResult`.

- `getClasspathElements()`, ordered collection of all pathElements that don't belong to the modulepath
Expand All @@ -68,3 +69,4 @@ All results will be stored in a `ResolvePathsResult`.
- `getPathElements()`, ordered map of the pathElements with their module descriptor

- `getPathExceptions()`, map of pathElements containing only the elements that faced an exception.

42 changes: 21 additions & 21 deletions plexus-java/src/site/markdown/usage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# LocationManager.resolvePaths

In order to use this class you must setup a `ResolvePathsRequest`, which requires a list of all the jars and output directories and the main module descriptor.
Expand All @@ -7,33 +6,34 @@ You start by using `ResolvePathsRequest.ofXXX`, where XXX is either Files, Paths

The `ResolvePathRequest` also contains:

* mainModuleDescriptor: the path or file of the main module descriptor, can either be `module-info.java` or `module-info.class`
* additionalModules: the modules that will be addedusing `-add-modules`
* jdkHome: in case you need to use a different JDK to extract the name from the modules. Can be interesting if the runtime is still Java 7.
* mainModuleDescriptor: the path or file of the main module descriptor, can either be `module-info.java` or `module-info.class`

* additionalModules: the modules that will be addedusing `-add-modules`

* jdkHome: in case you need to use a different JDK to extract the name from the modules. Can be interesting if the runtime is still Java 7.

The `ResolvePathsResult` contains:

* mainModuleDescriptor: the module descriptor of the passed descriptor file.
* pathElements: as a map in the same order as provided by the request. Every entry has a matching moduledescriptor when available.
* classpathElements: all the pathElements which should end up on the classpath.
* modulepathElements: all the pathElements which should end up on the modulepath. Per entry you get the source of the modulename which is either the moduledescriptor, the manifestfile of the filename. This information can be used to warn users in case they use automatic modules, which module names are not reliable yet.
* pathExceptions: pathElements with their exception while trying to resolve it. Only pathElements with an exception are listed.
* mainModuleDescriptor: the module descriptor of the passed descriptor file.

* pathElements: as a map in the same order as provided by the request. Every entry has a matching moduledescriptor when available.

* classpathElements: all the pathElements which should end up on the classpath.

* modulepathElements: all the pathElements which should end up on the modulepath. Per entry you get the source of the modulename which is either the moduledescriptor, the manifestfile of the filename. This information can be used to warn users in case they use automatic modules, which module names are not reliable yet.

* pathExceptions: pathElements with their exception while trying to resolve it. Only pathElements with an exception are listed.

# JavaVersion

This is a String based, lazy-parsing implementation of a Java Version which can be used to compare versions. It's goal is to support to support the following patterns:

* [JEP 223: New Version-String Scheme](https://openjdk.java.net/jeps/223)
* [JEP 322: Time-Based Release Versioning](https://openjdk.java.net/jeps/322)
* [JEP 223: New Version-String Scheme](https://openjdk.java.net/jeps/223)
* [JEP 322: Time-Based Release Versioning](https://openjdk.java.net/jeps/322)

Additional features:

* `JavaVersion.JAVA_SPECIFICATION_VERSION` represents `System.getProperty( "java.specification.version" )`

* `JavaVersion.JAVA_VERSION` represents `System.getProperty( "java.version" )`
* `JavaVersion.JAVA_SPECIFICATION_VERSION` represents `System.getProperty( "java.specification.version" )`

* `JavaVersion.JAVA_VERSION` represents `System.getProperty( "java.version" )`

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus</artifactId>
<version>19</version>
<version>20</version>
</parent>

<artifactId>plexus-languages</artifactId>
Expand Down