• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Maven does not show compilation error

 
Ranch Hand
Posts: 84
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a maven project opened in Intellij IDEA. There is a genuine compilation error message in a class the test directory. When I run maven compile from the IDE, it passes without errors. Why do the maven logs not show the compile error ?
 
Saloon Keeper
Posts: 11472
247
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "when I run maven compile from the IDE"? Do you mean running 'mvn compile'? If so, then you don't get any errors because the testCompile phase is after the compile phase, and your Maven build finishes before it tries to compile the test sources.

Try 'mvn package' to compile and run unit tests, and execute 'mvn verify' to compile and run integration tests.
 
Tom Joe
Ranch Hand
Posts: 84
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:What do you mean by "when I run maven compile from the IDE"? Do you mean running 'mvn compile'? If so, then you don't get any errors because the testCompile phase is after the compile phase, and your Maven build finishes before it tries to compile the test sources.

Try 'mvn package' to compile and run unit tests, and execute 'mvn verify' to compile and run integration tests.



I clicked the IDE button for "compile" under the Lifecycle menu of maven tab, and not run command mvn compile. I ran the test lifecycle instead and it now shows the expected compilation error in my test. How do I compile all the code (in main and test), directly from the maven tab, without running any tests? I could use Build menu instead, but I wanted to know if it can be done from the maven tab also.

 
Stephan van Hulst
Saloon Keeper
Posts: 11472
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, I think Eclipse is terrible for Maven projects. Maybe it contains an option for the test-compile phase, or maybe you can add your own configuration that executes 'mvn test-compile'.
 
Marshal
Posts: 6829
182
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Run > Run Configurations... you can create a Maven type configuration with specific goals.  But all this does is allow you to run Maven for inside Eclipse.  The output is all terminal type, just like you'd get from the command line.  Still...
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!