0

I am trying to do a maven build (lets say A.jar), where the property file resides in one of the dependencies (lets say, B.jar) that I am adding. Is there any way to add the properties from B.jar to A.jar or to read them in some way from B.jar? I looked at some questions, but none of them were helpful. I need to run an exec-maven-plugin, the class needs to read two property files from B.jar to run. At this point, I am moving around in circles. Is there something like an overlay (maven-war-plugin) in maven-jar-plugin or something that is similar?

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Class-Path>.</Class-Path>
                    </manifestEntries>
                </archive>
                <classifier>classes</classifier>
                <forceCreation>true</forceCreation>
            </configuration>
        </plugin>

This is my plugin configuration at the moment. But the plugin is very short of options! Thanks in advance!

Erik Nellessen
  • 402
  • 5
  • 9
hell_storm2004
  • 1,401
  • 2
  • 33
  • 66
  • Are A.jar and B.jar different applications? – Gimby Aug 19 '19 at 13:11
  • @Gimby No. They are part of the same parent POM. – hell_storm2004 Aug 19 '19 at 13:32
  • Then I'm confused. The properties files are in B.jar so you must already be aware of how to load files from the classpath - otherwise there'd be no reason to put them inside the jar. So... simply do that, load the files from the classpath. – Gimby Aug 19 '19 at 14:33
  • @Gimby I am trying to read the property using this, `InputStream resource = getClass().getClassLoader().getResourceAsStream(propertiesFileName);` It returns a Jar inputStream. And when I try to do a properties.load() with that inputStream it throws a null pointer exception. – hell_storm2004 Aug 20 '19 at 06:31

0 Answers0