0

There is a 3rd party jar which is dependent by many programs on the target machine. That jar file is named as abc.jar.

I can add the jar file to the local repository as abc-1.0.jar and package my project. But that means I must manually replace abc-1.0.jar when abc.jar updates. Here are my questions:

1.Is it possible to just use abc.jar when development with Intellij IDEA? I tried add the abc.jar to the External Libraries with dependency adding. But the editor can not recognize classes within abc.jar

2.If the answer is yes, What should I do to let the war file use the system level's abc.jar not the bundled within the ear?

Many thanks

yk42b
  • 179
  • 3
  • 15

2 Answers2

0

Find this?
correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project

or compile files in Gradle

compile files("src/main/resources/libs/sqljdbc4.jar")

put jar file to path

  • My project is managed by maven. As I described in question 1, classes in abc.jar can not be recognized by editor after I add the jar in External Libraries. – yk42b Nov 14 '17 at 08:16
0

You can add the abc.jar file to the particular module's dependency manually as described in mentioned SO answer and you also will have to manually add it to the artifact which is automatically generated by IDE based on Maven configuration.

Note that the artifact configuration will be overridden on the next re-import from Maven unless you create a copy of this artifact configuration and give it another name.

Generally such approach is not recommended for Maven project. Instead you should relay on Maven configuration.

Andrey
  • 15,144
  • 25
  • 91
  • 187
  • Nay. I already know what to do in the links. My issue is that it's not a solution to rename abc.jar to abc-$version.jar and put it in some repository. abc.jar must be used in Intellij IDEA and system level's abc.jar must be used on target machine not the bundled with war file – yk42b Nov 15 '17 at 01:25