1

I want to create the jar. When I want to change the configuration of connection to the database, I don't want to create a new jar. I want to change this configuration and restart. Can I create an external file for this?

   <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.ApplicationLaunch</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
  • 1
    Could this helps you? https://stackoverflow.com/questions/8775303/read-properties-file-outside-jar-file – code4fun Dec 19 '18 at 13:11

1 Answers1

0

If I understand correctly, you want to have minor changes in the jar without waiting for it to be rebuilt. That is not possible. I think what you need might be accomplished by passing arguments to the JVM when running the jar.

Something like

java –dDbConfigLocation="somePath" –jar MyApp.jar

If this is applicable for you use case, you don't need maven but rather use the args[] in the main method of com.ApplicationLaunch.