Error :
java.io.FileNotFoundException: class path resource [xml/ruleSet.xml] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/app/target/******-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/xml/ruleSet.xml
Code :
File ruleSet = new ClassPathResource("xml/ruleSet.xml").getFile();
pmdConfiguration.setReportFormat("text");
pmdConfiguration.setRuleSets(ruleSet.getAbsolutePath());
I need to insert the full file into the setRuleSets method, how will FileInputStream help me here?
FileInputStream ruleSet = new FileInputStream(ClassLoader.getSystemResource
("xml/ruleSet.xml").getPath());
Should I recreate a temp file by reading the fileinput stream and pass that file path to setRuleSets
method?