How to access resources in jar where it can be present in multiple jar

前端 未结 2 1464
情书的邮戳
情书的邮戳 2021-01-13 21:09

I have a project where I generate lots of code against many XSD. To keep things separate each set of XSD are bundled together within a project. I have multiple project tha

2条回答
  •  别那么骄傲
    2021-01-13 21:55

    If the XSDs all have the same name, you will need another criteria with knowledge of what the "right one" is. Can you embed some information in it (or with it, like a properties file or something) indicating its purpose?

    And, a more convenient iterator to get them might be:

     getClass().getClassLoader().getResources("/file.xsd");
    

    or something. (Relies on the classpath, whether it is on the file system or in a jar)

提交回复
热议问题