Closed ljy1058318852 closed 6 months ago
After investigation, I found that this JavaScript code is not supported and points to a new RegExp:
function hex_normalize(data) {
return data.toLowerCase().replace(new RegExp('[^\\da-f]', 'gi'), '');
}
error:
at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:88)
at <js> hex_normalize(Unnamed:40:1304-1332)
Found the reason, due to package conflicts and packaging overwriting.
By modifying the packaging plugin, it will allow components with duplicate names to coexist. This is my mvn pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.potato.potatotool.ToStart</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
environment
JAVA11.0
MVN project
MacOS
Pom.xml configuration:
Call code:
Successfully run a section of JavaScript in idea;
After packaging into fatjar, the operation failed with an error: