Skip to content

Commit fe2ac45

Browse files
committed
Remove jline-native and JPMS support, extract org.apache.maven.api.classworld to separate API module
- Remove jline-native references from Maven launcher scripts (mvn and mvn.cmd) - Remove jline-native dependencies and configurations from POMs - Remove module-info.java file from maven-classworlds - Remove jline-native assembly configurations and README - Create new maven-api-classworlds module in api/ directory - Move org.apache.maven.api.classworlds package to new API module - Update dependency management and module references - Add maven-api-classworlds dependency to modules that use the API This change separates the public API from the implementation, following Maven 4 architecture patterns, and removes the JPMS and jline-native dependencies that were causing complexity in the build and runtime environment.
1 parent 99447f1 commit fe2ac45

File tree

143 files changed

+6903
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+6903
-152
lines changed

apache-maven/src/assembly/component.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ under the License.
2323
<useProjectArtifact>false</useProjectArtifact>
2424
<outputDirectory>boot</outputDirectory>
2525
<includes>
26-
<include>org.codehaus.plexus:plexus-classworlds</include>
26+
<include>org.apache.maven:maven-classworlds</include>
2727
</includes>
2828
</dependencySet>
29+
2930
<dependencySet>
3031
<useProjectArtifact>false</useProjectArtifact>
3132
<outputDirectory>lib</outputDirectory>
3233
<excludes>
33-
<exclude>org.codehaus.plexus:plexus-classworlds</exclude>
34+
<exclude>org.apache.maven:maven-classworlds</exclude>
3435
</excludes>
3536
</dependencySet>
3637
</dependencySets>

apache-maven/src/assembly/maven/bin/mvn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ concat_lines() {
190190

191191
MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`"
192192
MAVEN_OPTS="$MAVEN_OPTS `concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"`"
193-
LAUNCHER_JAR=`echo "$MAVEN_HOME"/boot/plexus-classworlds-*.jar`
193+
LAUNCHER_JAR=`echo "$MAVEN_HOME"/boot/maven-classworlds-*.jar`
194194
LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher
195195

196196
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command

apache-maven/src/assembly/maven/bin/mvn.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ goto processArgs
247247
:endHandleArgs
248248
call :processArgs %*
249249

250-
for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set LAUNCHER_JAR="%%i"
250+
for %%i in ("%MAVEN_HOME%"\boot\maven-classworlds-*) do set LAUNCHER_JAR="%%i"
251251
set LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher
252252
if "%MAVEN_MAIN_CLASS%"=="" @set MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling
253253

apache-maven/src/main/appended-resources/META-INF/LICENSE.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ subject to the terms and conditions of the following licenses:
6767
#* *##end
6868
#* *###
6969
#* *### Classworlds is in boot directory, not in lib
70-
#* *##if ( $project.artifact.artifactId == "plexus-classworlds" )
70+
#* *##if ( $project.artifact.artifactId == "maven-classworlds" )
7171
#* *##set ( $directory = 'boot' )
7272
#* *##end
7373
#* *###

api/maven-api-classworlds/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.apache.maven</groupId>
24+
<artifactId>maven-api</artifactId>
25+
<version>4.1.0-SNAPSHOT</version>
26+
</parent>
27+
28+
<artifactId>maven-api-classworlds</artifactId>
29+
<name>Maven 4 API :: Classworlds</name>
30+
<description>Maven 4 API for class loading realms and isolation.</description>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.apache.maven</groupId>
35+
<artifactId>maven-api-annotations</artifactId>
36+
</dependency>
37+
</dependencies>
38+
39+
</project>
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.maven.api.classworlds;
20+
21+
import java.io.Closeable;
22+
import java.net.URL;
23+
24+
import org.apache.maven.api.annotations.Experimental;
25+
import org.apache.maven.api.annotations.Nonnull;
26+
import org.apache.maven.api.annotations.Nullable;
27+
28+
/**
29+
* A class loading realm that provides isolated class loading with controlled imports and exports.
30+
* <p>
31+
* A ClassRealm represents an isolated class loading environment with its own classpath
32+
* and controlled access to classes from other realms through imports.
33+
* </p>
34+
*
35+
* @since 4.1.0
36+
*/
37+
@Experimental
38+
public interface ClassRealm extends Closeable {
39+
40+
/**
41+
* Returns the unique identifier for this realm.
42+
*
43+
* @return the realm identifier
44+
*/
45+
@Nonnull
46+
String getId();
47+
48+
/**
49+
* Returns the class world that contains this realm.
50+
*
51+
* @return the parent class world
52+
*/
53+
@Nonnull
54+
ClassWorld getWorld();
55+
56+
/**
57+
* Returns the underlying ClassLoader for this realm.
58+
* <p>
59+
* This method allows access to the actual ClassLoader implementation
60+
* while maintaining API abstraction.
61+
* </p>
62+
*
63+
* @return the underlying ClassLoader
64+
*/
65+
@Nonnull
66+
ClassLoader getClassLoader();
67+
68+
/**
69+
* Returns the class loading strategy used by this realm.
70+
*
71+
* @return the strategy
72+
*/
73+
@Nonnull
74+
Strategy getStrategy();
75+
76+
/**
77+
* Adds a URL to this realm's classpath.
78+
*
79+
* @param url the URL to add
80+
*/
81+
void addURL(@Nonnull URL url);
82+
83+
/**
84+
* Returns the URLs in this realm's classpath.
85+
*
86+
* @return array of URLs in the classpath
87+
*/
88+
@Nonnull
89+
URL[] getURLs();
90+
91+
/**
92+
* Imports classes from the specified realm for the given package.
93+
*
94+
* @param realmId the identifier of the realm to import from
95+
* @param packageName the package name to import (supports wildcards)
96+
* @throws NoSuchRealmException if the specified realm doesn't exist
97+
*/
98+
void importFrom(@Nonnull String realmId, @Nonnull String packageName) throws NoSuchRealmException;
99+
100+
/**
101+
* Imports classes from the specified class loader for the given package.
102+
*
103+
* @param classLoader the class loader to import from
104+
* @param packageName the package name to import (supports wildcards)
105+
*/
106+
void importFrom(@Nonnull ClassLoader classLoader, @Nonnull String packageName);
107+
108+
/**
109+
* Returns the class loader that would handle the specified class name through imports.
110+
*
111+
* @param name the class name
112+
* @return the import class loader, or null if no import matches
113+
*/
114+
@Nullable
115+
ClassLoader getImportClassLoader(@Nonnull String name);
116+
117+
// Note: getImportRealms method is not included in the API interface
118+
// to avoid conflicts with the existing implementation signature
119+
120+
/**
121+
* Sets the parent class loader for this realm.
122+
*
123+
* @param parentClassLoader the parent class loader, may be null
124+
*/
125+
void setParentClassLoader(@Nullable ClassLoader parentClassLoader);
126+
127+
/**
128+
* Returns the parent class loader for this realm.
129+
*
130+
* @return the parent class loader, may be null
131+
*/
132+
@Nullable
133+
ClassLoader getParentClassLoader();
134+
135+
// Note: setParentRealm method is not included in the API interface
136+
// to avoid conflicts with the existing implementation signature
137+
138+
// Note: getParentRealm method is not included in the API interface
139+
// to avoid conflicts with the existing implementation signature
140+
141+
// Note: createChildRealm method is not included in the API interface
142+
// to avoid conflicts with the existing implementation signature
143+
144+
/**
145+
* Loads a class from this realm only (not from imports or parent).
146+
*
147+
* @param name the class name
148+
* @return the loaded class, or null if not found
149+
*/
150+
@Nullable
151+
Class<?> loadClassFromSelf(@Nonnull String name);
152+
153+
/**
154+
* Loads a class from imported realms/classloaders.
155+
*
156+
* @param name the class name
157+
* @return the loaded class, or null if not found
158+
*/
159+
@Nullable
160+
Class<?> loadClassFromImport(@Nonnull String name);
161+
162+
/**
163+
* Loads a class from the parent class loader.
164+
*
165+
* @param name the class name
166+
* @return the loaded class, or null if not found
167+
*/
168+
@Nullable
169+
Class<?> loadClassFromParent(@Nonnull String name);
170+
171+
/**
172+
* Loads a resource from this realm only (not from imports or parent).
173+
*
174+
* @param name the resource name
175+
* @return the resource URL, or null if not found
176+
*/
177+
@Nullable
178+
URL loadResourceFromSelf(@Nonnull String name);
179+
180+
/**
181+
* Loads a resource from imported realms/classloaders.
182+
*
183+
* @param name the resource name
184+
* @return the resource URL, or null if not found
185+
*/
186+
@Nullable
187+
URL loadResourceFromImport(@Nonnull String name);
188+
189+
/**
190+
* Loads a resource from the parent class loader.
191+
*
192+
* @param name the resource name
193+
* @return the resource URL, or null if not found
194+
*/
195+
@Nullable
196+
URL loadResourceFromParent(@Nonnull String name);
197+
}

0 commit comments

Comments
 (0)