Reputation: 8118
I need some resources that are under:
src/main/resources/__files/
Now when creating my jar with maven those are not included.
This is my pomfile:
when creating my app I get this:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wiremock 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wiremock ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ wiremock ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/betauser/Documents/Development/wiremock/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wiremock ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/betauser/Documents/Development/wiremock/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ wiremock ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ wiremock ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.2:jar (default-jar) @ wiremock ---
[INFO] Building jar: /Users/betauser/Documents/Development/wiremock/target/WiremockServer.jar
[INFO]
[INFO] --- maven-dependency-plugin:2.9:copy-dependencies (copy-dependencies) @ wiremock ---
[INFO] Copying slf4j-api-1.7.6.jar to /Users/betauser/Documents/Development/wiremock/target/dependency-jars/slf4j-api-1.7.6.jar
[INFO] Copying wiremock-1.52-standalone.jar to /Users/betauser/Documents/Development/wiremock/target/dependency-jars/wiremock-1.52-standalone.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.229 s
[INFO] Finished at: 2014-12-11T14:40:16+01:00
[INFO] Final Memory: 14M/81M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
and when I run my program and I ask the file I get:
java.io.FileNotFoundException: /Users/betauser/Documents/Development/wiremock/target/src/main/resources/__files/test-long.mp3 (No such file or directory)
Upvotes: 0
Views: 567
Reputation: 5000
I wonder about the output ".../target/src/main/resources/..." .
The directory structure "src/main/resources" can't exist below "target", if your artifact builds properly.
The files you create in /src/main/resources and below belong to the classpath of your application.
Open your artifact (jar) which was created during the build process. There you should find a directory entry named "__files".
Upvotes: 1