1

Case in question: A Maven based project that has a Maven Run Configuration with its 'Command line' parameters defined as clean install.

Clicking the green arrow to invoke 'Run my_maven_config' downloads all necessary packages from Nexus and completes the build successfully.

Selecting 'Build Project' however, invokes a seemingly similar process but after building successfully for quite a while, it fails on a missing Hibernate package.

Why is this difference?

Shouldn't the build part of 'Run' be identical to the "standalone build"?

datv
  • 585
  • 3
  • 15
  • 2
    They are not identical. IntelliJ IDEA imports the external project model from Maven and converts it to the internal project model. It's not 100% accurate, some plug-ins are not supported, some dependencies may fail to resolve, etc. See http://stackoverflow.com/a/42427510/104891 to perform the diagnostics. Try reimporting. Delegating builds to Maven as it can be done now with Gradle will be supported later (probably in IntelliJ IDEA 2018.3). – CrazyCoder Jul 05 '18 at 08:49
  • @CrazyCoder Thank you. If you post your comment as an answer, I will upvote it and accept it as *the* answer. – datv Jul 05 '18 at 08:54

2 Answers2

4

They are not identical. IntelliJ IDEA imports the external project model from Maven and converts it to the internal project model. It's not 100% accurate, some Maven plug-ins are not supported, some dependencies may fail to resolve, etc.

See this answer to perform the diagnostics. Try re-importing the project (delete .idea directory first if it doesn't help).

Delegating build/run actions to Maven as it can be done now with Gradle will be supported later (probably in IntelliJ IDEA 2018.3).

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
1

Now IntelliJ IDE allow to delegate Build actions to maven. Go to Preferences and search for "Delegate IDE build actions to maven".

So when you build a project, IntelliJ IDEA invokes the appropriate Maven goals.

obe6
  • 1,743
  • 15
  • 23