Nat
Nat

Reputation: 899

Maven Error : Maven Project Configuration for Module isn't available

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 am using a multi-module project.

Upvotes: 66

Views: 90276

Answers (20)

Peng Fan
Peng Fan

Reputation: 1

Rebuild the Project:

  • Go to the menu bar and click on Build.
  • Select Rebuild Project. This often resolves the issue.

Upvotes: 0

Manish Patil
Manish Patil

Reputation: 37

  • Go to event log and from there you will see options, what need to fix it

Upvotes: -2

Venkat Adapa
Venkat Adapa

Reputation: 151

In case of IntelliJ , Right click on the POM.xml file of your project and click on the option "Add as Maven Project".

Upvotes: 13

AmanicA
AmanicA

Reputation: 5495

I chose the bundled maven installation which helped me.

It could also be something to do with using a symlink to reference the maven installation..

it turns out the version of intelliJ I use (2018.3) can't import maven projects using apache-maven-3.6.2

enter image description here

Upvotes: 1

Kris_Jiaqi_Xie
Kris_Jiaqi_Xie

Reputation: 7

I was troubled by this problem all afternoon,the solution in stackoverflow is not usefull for me.But I just solved this problem by accident,i don't kown how it worked,but it is effective.If you have the same project structure. project structure

you can try this try this button

and you will found all children project is build success. then you can run all project normally.

Upvotes: 0

hugoalexandremf
hugoalexandremf

Reputation: 316

In my case I had all configured to execute the hot reload with devtools after each file change namely:

  1. File -> Settings -> Build, Execution, Deployment -> Compiler -> Enable "Build project automatically";
  2. File -> Settings -> Advanced Settings -> Allow auto-make to start even if developed application is currently running.

The maven related error in the Auto-build tab was being displayed and only went away when I deleted .idea folder in the root directory, opened the project again, built the project without maven config (build as Ant project), and configured all again. After the reset the error disappeared and the maven build was executed without errors.

Upvotes: 0

54138qqqq
54138qqqq

Reputation: 127

I am using IDEA with WSL2 and Windows10. My problem occurred when IDEA automatically set the JDK in WSL2 as project JDK. After Setting my JDK back to Windows JDK, the error disappearred.

Upvotes: 0

harsh
harsh

Reputation: 627

In my case, I invalidated the cache and restarted the IDE. It worked, not sure why though.

Upvotes: 1

Will
Will

Reputation: 434

My problem with this error under 2019.3.4 is related to the build delegating to Maven. Idea is letting Maven build my project first and that build is failing because I broke a test. I get around this problem by not allowing IDEA to delegate to Maven. On Mac OS Catalina: Intellij -> Preferences -> Build, Execution, Deployment -> Build Tools -> Runner and uncheck Delegate IDE Build/run actions to Maven

enter image description here

Upvotes: 9

HZhang
HZhang

Reputation: 183

In my case, I had to use the following trick:

  1. Right click the module name in the project panel

  2. Select "Open Module Settings"

  3. In the pop-up window, click Dependencies

  4. Select java version 1.8.0_151

Upvotes: 3

ᴠɪɴᴄᴇɴᴛ
ᴠɪɴᴄᴇɴᴛ

Reputation: 1693

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.

Screen dump of Maven Projects view in IntelliJ

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.

Upvotes: 1

Kajzer
Kajzer

Reputation: 2385

Right-click on pom.xml and then click on "Add as Maven Project".

Upvotes: 123

Pro
Pro

Reputation: 91

Quick solution (IntelliJ IDEA): Right-click on the project, the select Maven->Reimport

Upvotes: 2

Will Brode
Will Brode

Reputation: 1126

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.

Upvotes: 1

Dherik
Dherik

Reputation: 19050

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.

Upvotes: 1

Maksymilian Wojakowski
Maksymilian Wojakowski

Reputation: 5081

In my case the problem ocurred after uprgrading IJ from 14.x to 15.x and disappeared when I issued Build -> Rebuild Project

Upvotes: 41

asmaier
asmaier

Reputation: 11746

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.

Upvotes: 0

Ojitha
Ojitha

Reputation: 980

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.

Upvotes: 66

user5426077
user5426077

Reputation: 1

modify .idea/compiler.xml,add config(should change module name to yourself):

Upvotes: 0

Lars Gendner
Lars Gendner

Reputation: 1982

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.

Upvotes: 2

Related Questions