0

i am trying to build an artifact from a modified maven project imported in intellij (v2016.2).

Have managed to:

(1) Import/build a multi module maven project in intellij

(2) Successfully built/run an artifact as a single jar from the project

(3) Modified maven project by writing new classes with extra depedencies (via changing project's structure and adding new maven dependencies*)

(4) Successfully built & run modified project

however, when i try to run an artifact from the modified project (and even if it contains all the dependencies in the jar), it completely ignores all the extra functionality of the modified project (runs exactly as in (2))

What am I missing?

*note: havent touched any poms till now. All the dependencies added using File>Project Structure>Modules>Dependencies>add Library ...

gep
  • 93
  • 1
  • 7

1 Answers1

0

If you don't see any change when running the project it's because you run the the previous build.

"Add Library" won't update your pom.xml. (Add maven dependency... will do)

To fix your maven project, you need to edit the pom.xml by hand to add the new libraries. (section dependencies) Once it's done run mvn clean build from command line or from the maven project window (on the right edge of IntelliJ window).

ben75
  • 29,217
  • 10
  • 88
  • 134
  • thanks for your answer.. As for your first suggestion, i dont have any unresolved references (by adding maven dependencies via 'add library' its been taken care of) and my build is updated in every case/test. And yes editing pom may be the solution but isnt it odd that i have to do this only for the artifact? – gep Aug 07 '16 at 11:47
  • Also when configuring the artifact the new dependencies were already added to the list ... – gep Aug 07 '16 at 11:51
  • Also x2 / just for fun / did what you suggested from the start, i.e. imported the project, modified it and tried to resolve the class dependency by the instructions you linked .. Its not working at all, in fact i had first to add the maven repo via 'add library' from project structure settings and only THEN the relevant classes appear in the suggestion list of 'Add Maven Dependency' options ... – gep Aug 07 '16 at 13:02
  • Also x3 added the dependency in all possible poms ;) of the project. Build via cli maven or intellij works but artifact absolutely refuse to use the new classes / so frustrating – gep Aug 07 '16 at 19:04