• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Maven does not show compilation error

 
Ranch Hand
Posts: 143
6
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 13072
281
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 143
6
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 13072
281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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'.
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic