0

I have one java application and calling a static yaml in the /src/main/resources folder. Now if i run this application everything is just fine. But when i am importing this jar in some other pom. After adding the dependency tag in pom and adding the jar in libs/u1/u1/1.3 folder : u1 u1 1.3

and the repository :

   <repository>
        <id>in-project</id>
        <name>In Project Repo</name>
        <url>file://${project.basedir}/libs</url>
    </repository>

It is identifying the jar but giving the below error as if it is looking for the yaml in its folder !! How to prevent this and add this in run time.

java.io.FileNotFoundException: src\main\resources\regexes.yaml

Mohit H
  • 927
  • 3
  • 11
  • 26
  • The fact that the error is `FileNotFoundException: src\main\resources\regexes.yaml`, means that the code is not retrieving it right. This is a classpath resource, not a file, and should be accessed with an `InputStream`. – Tunaki Jan 11 '17 at 09:11
  • i want to use the jar which is working standalone , which has this resource. But when i am importing this jar in some other application , it is throwing that error. – Mohit H Jan 11 '17 at 09:20
  • Yes, please refer to the linked question. The resource is not being accessed using an `InputStream`, so while it appears to work standalone, it doesn't when used by other projects, or it wouldn't if packaged in a JAR and executed. – Tunaki Jan 11 '17 at 09:24

0 Answers0