java - Properties file could not be found by getResourceAsStream(). Check the CLASSPATH or class loader -
this open source project there no support. compilation of project went well. cannot test or install because of particular property file cannot found. have search , down internet , not able find solutions. organization of director little bit unconventional.
some directories. core/src/main/java/org/mskcc/cbio/portal/util/config.java.
string props = "portal.properties"; inputstream in = this.getclass().getclassloader().getresourceasstream(props); ... more directoires. src/main/resources/portal.properties.
this last src directory has 1 subdirectory main, , main directory has 1 resources subdirectory. file not found located here.
i using java 1.7. maven 3.0.5 command used mvn install
i must missing 1 simple configuration somewhere.
there got can resolve easily.
src/main/resources is, default, path of aplication/library resources in maven. but, can optionally force in pom.xml.
1) add in pom.xml
<resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> 2) run maven -> mvn clean install
3) search portal.properties @ build generated @ "target" folder. assert portal.properties in root of artifact classpath (root of .jar, .ear or /classes in .war).
Comments
Post a Comment