Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

java - Maven package works but Intellij's build fails

I have a JDK 1.7 project with a maven dependency to a local jar in my maven repo.

I'm unable to build the project using Intellij, with the errors that a symbol cannot be found (the symbol is a class importing packages from the local jar)

But I can successfully build the project using 'mvn package'.

I've spent so much time looking for solutions, things I've already done:

  • Invalidated cache
  • 'mvn clean install' the local jar dependecy
  • Marked to 'autoload snapshots' in Intellij's maven configuration
  • Reimpoted maven in Intellij
  • Syncornized

This error happend to my couple of times before, but usually just closing the Intellij and /or doing the 'mvn clean install' did the trick.

Please help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I know this is late but executing mvn idea:idea solves the issue.

The command re-generates the crucial IntelliJ IDEA files: ipr, iml, and iws, and thus re-align them with your pom.xml.

Documentation: https://maven.apache.org/plugins/maven-idea-plugin

The plugin is retired but still (as of 05.06.2021) works like magic :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...