可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I keep getting this error when I try to compile my code. I have the pom.xml file in my directories but I am not sure if there is something wrong in there. I found only one link on the internet regarding this and that was not my case: Maven project configuration required for module
Error:Maven Resources Compiler: Maven project configuration required for module 'updater' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE.
Here is the content of my pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nothing.updater</groupId>
<artifactId>Updater</artifactId>
<version>1.0-SNAPSHOT</version>
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>com.nothing.toolbox</groupId>-->
<!--<artifactId>Toolbox</artifactId>-->
<!--<version>1.1</version>-->
<!--</dependency>-->
<!--</dependencies>-->
</project>
I would really appreciate your help. Thanks!
回答1:
Right click the module and select the Make Module "project module name" option from the pop up menu. The messages will be shown. But go to Problems and see now. This will clear and correct this problem.
回答2:
Right-click on pom.xml and then click on "Add as Maven Project".
回答3:
In my case the problem ocurred after uprgrading IJ from 14.x to 15.x and disappeared when I issued Build -> Rebuild Project
回答4:
The messages originates from Line 43 in /org/jetbrains/jps/maven/compiler/MavenResourcesBuilder.java, so my guess is that it is no pom.xml issue but rather IntelliJ Idea related.
If you dig further into the code, it looks for a file called maven/configuration.xml
and from what I see, it searches in some temporary directory.
Maybe you should try and start your build as clean as possible.
回答5:
In my case this was caused by a misconfiguration of IntelliJ. A long time ago I had been experimenting with the Lifecycle
options within the Maven Projects
view and had left a few phases in a sub module checked as Execute Before Build
.
Because I had completely forgotten having checked these, it took me quite some time to understand the connection with the error messages in the Problems
view. After unchecking the Execute Before Build
switches of the affected phases everything went back to normal and particularly running unit tests became much faster.
回答6:
modify .idea/compiler.xml,add config(should change module name to yourself):
回答7:
In my case I got this error message, because my Maven configuration in IntelliJ was broken. I had entered invalid options into VM options for importer
at Preferences:Build,Execution,Deployment->Build Tools->Maven->Importing
.
After deleting these options IntelliJ started to behave normal again.
回答8:
I have the same error after a Intellij Idea version upgrade (2016.3 to 2017.1):
Error:Maven Resources Compiler: Maven project configuration required
for module 'MODULE_NAKE' isn't available. Compilation of Maven
projects is supported only if external build is started from an IDE.
But my solution was another. Somehow, I think the Intellij lost the maven version used in my project. I was using maven 2.2.1 but Intellij was trying to use maven 3.x.
So, my solution was adjust this configuration in:
File > Settings > Build, Execution, Deployment > Build Tools > Maven
And set the maven version to 2.2.1.
回答9:
I had this problem after an Intellij Idea version upgrade. The fix was to wait for it to finish indexing. Then I think it downloaded some stuff it needed.
Makes me think that the other answers on this thread about the IJ version upgrade probably just needed to wait as well - by the time they finished trying a few things the problem was fixed by itself.
回答10:
Quick solution (IntelliJ IDEA):
Right-click on the project, the select Maven->Reimport