0

I have a project with many modules that compiles fine in intellij.

When I try to build it in maven (via clean install) I get "COMPILATION ERROR : " and many problems on a specific module, that on IntelliJ are just fine.

I tried restarting Intellij (and cleaned the caches), I tried to uninstall it and reinstall it, tried to uncheck and check reimport automatically, tried reimporitng all the projects, and building and installing them all (and succeeded), updating the repository path, tried to install new maven (3.6 instead of 3.3), and even tried to run maven via the terminal - all that didn't help.

EDIT: I even tried cleaning maven's cache like in here, but failed.

Maven clean succeeds.

I use mac.

So basically my project works, maven doesn't. What could be the problem?

Ran
  • 657
  • 2
  • 13
  • 29
  • Your question seems contradictory. Does it work with Maven and fail on IntelliJ, or vice-versa? – Tim Biegeleisen Jan 20 '19 at 13:06
  • "Install fails in maven, but succeeds in IntelliJ directly" – Ran Jan 20 '19 at 13:11
  • This is unusual, and typically it is the other way around. What are the compilation errors? Maybe this is a library problem. For example, your IntelliJ is pulling in some resources itself which rightfully should be a part of the POM. – Tim Biegeleisen Jan 20 '19 at 13:14
  • I updated a project, and maven seems to refer to the old project, without the changes I pulled. I tried to "cat" the pom of the project, and it had the changes. – Ran Jan 20 '19 at 13:16
  • You are missing the point of my comment. – Tim Biegeleisen Jan 20 '19 at 13:18
  • "cannot find symbol" in a module specified in the pom. If I click on the error in intellij, it seems fine (as it should be). – Ran Jan 20 '19 at 13:22

1 Answers1

0

The problem was that the project I included was a spring boot project, and that made maven confused (but unfortunately, IntelliJ was ok with it).

Adding this fixed the problem:

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <classifier>exec</classifier>
            </configuration>
        </plugin>
Ran
  • 657
  • 2
  • 13
  • 29