File tree Expand file tree Collapse file tree
src/main/java/com/xwintop/xJavaFxTool Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454
5555 <!-- https://mvnrepository.com/artifact/io.github.classgraph/classgraph -->
5656 <!-- https://github.com/classgraph/classgraph -->
57- <dependency >
58- <groupId >io.github.classgraph</groupId >
59- <artifactId >classgraph</artifactId >
60- <version >4.8.100</version >
61- </dependency >
57+ <!-- <dependency> -- >
58+ <!-- <groupId>io.github.classgraph</groupId> -- >
59+ <!-- <artifactId>classgraph</artifactId> -- >
60+ <!-- <version>4.8.100</version> -- >
61+ <!-- </dependency> -- >
6262 </dependencies >
6363 <build >
6464 <plugins >
Original file line number Diff line number Diff line change 11package com .xwintop .xJavaFxTool .plugin ;
22
3- import io .github .classgraph .ClassGraph ;
4-
53import java .io .File ;
64import java .net .MalformedURLException ;
7- import java .net .URI ;
85import java .net .URL ;
96import java .net .URLClassLoader ;
10- import java .util .ArrayList ;
11- import java .util .List ;
127
138/**
149 * 用于加载插件的 ClassLoader
@@ -20,17 +15,22 @@ public static PluginClassLoader create(File jarFile) {
2015 }
2116
2217 public static PluginClassLoader create (ClassLoader parent , File jarFile ) {
23- List <URI > uris = new ArrayList <>(new ClassGraph ().getClasspathURIs ());
24- uris .add (jarFile .toURI ());
25-
26- URL [] urls = uris .stream ().map (uri -> {
27- try {
28- return uri .toURL ();
29- } catch (MalformedURLException e ) {
30- throw new RuntimeException (e );
31- }
32- }).toArray (URL []::new );
33-
18+ // List<URI> uris = new ArrayList<>(new ClassGraph().getClasspathURIs());
19+ // uris.add(jarFile.toURI());
20+ // URL[] urls = uris.stream().map(uri -> {
21+ // try {
22+ // return uri.toURL();
23+ // } catch (MalformedURLException e) {
24+ // throw new RuntimeException(e);
25+ // }
26+ // }).toArray(URL[]::new);
27+
28+ URL [] urls = null ;
29+ try {
30+ urls = new URL []{jarFile .toURI ().toURL ()};
31+ } catch (MalformedURLException e ) {
32+ throw new RuntimeException (e );
33+ }
3434 return new PluginClassLoader (urls , parent );
3535 }
3636
Original file line number Diff line number Diff line change 55import com .xwintop .xJavaFxTool .common .logback .ConsoleLogAppender ;
66import com .xwintop .xJavaFxTool .controller .IndexController ;
77import com .xwintop .xJavaFxTool .model .PluginJarInfo ;
8- import com .xwintop .xJavaFxTool .plugin .PluginClassLoader ;
98import com .xwintop .xJavaFxTool .plugin .PluginContainer ;
109import com .xwintop .xJavaFxTool .utils .Config ;
1110import com .xwintop .xJavaFxTool .utils .XJavaFxSystemUtil ;
@@ -141,7 +140,7 @@ public void loadPlugin(PluginJarInfo pluginJarInfo) {
141140 */
142141 public static Tab loadIsolatedPluginAsTab (PluginJarInfo plugin , TabPane tabPane , boolean singleWindowBoot ) {
143142 try {
144- PluginContainer pluginContainer = new PluginContainer (PluginClassLoader . class . getClassLoader (), plugin );
143+ PluginContainer pluginContainer = new PluginContainer (plugin );
145144 FXMLLoader generatingCodeFXMLLoader = pluginContainer .createFXMLLoader ();
146145 if (generatingCodeFXMLLoader == null ) {
147146 return null ;
You can’t perform that action at this time.
0 commit comments