One issue that I am facing involves the project structure of my Maven Java project. It follows a typical layout:
src/main/java - project .java files
src/main/resources - project resources (log4j2.xml)
src/test/java - .java files for tests
src/test/resources - testng.xml file
In the src/main/java directory, there is a package containing JavaScript files (scripts that are executed programmatically in Java code) located at: src/main/java/js/scripts/
While I can access the *.js files within the 'scripts' folder when running tests using FileUtils.readFileToString(new File(pathTo_jsFile)), this functionality ceases to work after compiling the project with Maven.
I am unable to compile the files to be placed inside the existing package (/js/scripts/) – the only way I have found to add non-Java files to the .jar is by including them as resources in the pom.xml, but then they are added to the root of the .jar file.
I am also unable to read anything from within the .jar file.