mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
    <modelVersion>4.0.0</modelVersion>
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
    <groupId>pw.yumc</groupId>
 | 
					    <groupId>pw.yumc</groupId>
 | 
				
			||||||
    <artifactId>YumCore</artifactId>
 | 
					    <artifactId>YumCore</artifactId>
 | 
				
			||||||
    <version>1.8.6</version>
 | 
					    <version>1.8.7</version>
 | 
				
			||||||
    <build>
 | 
					    <build>
 | 
				
			||||||
        <finalName>${project.artifactId}</finalName>
 | 
					        <finalName>${project.artifactId}</finalName>
 | 
				
			||||||
        <plugins>
 | 
					        <plugins>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,8 @@ import javax.script.ScriptEngineManager;
 | 
				
			|||||||
import javax.script.ScriptException;
 | 
					import javax.script.ScriptException;
 | 
				
			||||||
import javax.script.SimpleBindings;
 | 
					import javax.script.SimpleBindings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 喵式脚本引擎
 | 
					 * 喵式脚本引擎
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -59,7 +61,9 @@ public class MiaoScriptEngine implements ScriptEngine, Invocable {
 | 
				
			|||||||
        } catch (final NullPointerException ignored) {
 | 
					        } catch (final NullPointerException ignored) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (engine == null) {
 | 
					        if (engine == null) {
 | 
				
			||||||
            File nashorn = new File(System.getProperty("java.ext.dirs").split(File.pathSeparator)[0], "nashorn.jar");
 | 
					            val dirs = System.getProperty("java.ext.dirs").split(File.pathSeparator);
 | 
				
			||||||
 | 
					            for (String dir : dirs) {
 | 
				
			||||||
 | 
					                File nashorn = new File(dir, "nashorn.jar");
 | 
				
			||||||
                if (nashorn.exists()) {
 | 
					                if (nashorn.exists()) {
 | 
				
			||||||
                    try {
 | 
					                    try {
 | 
				
			||||||
                        Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
 | 
					                        Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
 | 
				
			||||||
@@ -70,10 +74,12 @@ public class MiaoScriptEngine implements ScriptEngine, Invocable {
 | 
				
			|||||||
                        method.invoke(Thread.currentThread().getContextClassLoader(), url);
 | 
					                        method.invoke(Thread.currentThread().getContextClassLoader(), url);
 | 
				
			||||||
                        engineManager = new ScriptEngineManager();
 | 
					                        engineManager = new ScriptEngineManager();
 | 
				
			||||||
                        engine = engineManager.getEngineByName(engineType);
 | 
					                        engine = engineManager.getEngineByName(engineType);
 | 
				
			||||||
                } catch (NoSuchMethodException | MalformedURLException | IllegalAccessException | InvocationTargetException ignored) {
 | 
					                    } catch (NoSuchMethodException | MalformedURLException | IllegalAccessException | InvocationTargetException | NullPointerException ignored) {
 | 
				
			||||||
                    ignored.printStackTrace();
 | 
					                    }
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            throw new UnsupportedOperationException("当前环境不支持 " + engineType + " 脚本类型!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user