Maven Error : Maven Project Configuration for Module isn't available
Asked Answered
P

20

62

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.

Protactinium answered 14/8, 2015 at 15:15 Comment(0)
S
66

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.

Seligman answered 12/10, 2015 at 2:18 Comment(4)
Just had same issue with a rather intricate maven project with 2017.2.1. Why does this help?Woodnote
This just fixed a problem I had when upgrading from 2019.1.2 to 2019.2.1; so whatever is going on, it is still an issue.Arvizu
In IntelliJ 2019.3 the menu item I found was 'Build Module <project module name>'.Stakeout
I'm on IntelliJ and I can not find the option to 'Make Module'. Thanks, tho'.Eosinophil
D
114

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

Dixie answered 7/11, 2017 at 7:3 Comment(5)
Worked on 2018.2.1Bibbs
This solve this error, that I had: Error:Maven Resources Compiler: Maven project configuration required for module '...' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE.Korea
It's already added as Maven Project in my case. Tried 'Unlink Maven Project' and followed the solution then, but it didn't work. Thanks, tho'.Eosinophil
Worked for me in 2022. ThanksTrstram
Solved it for meBranching
S
66

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.

Seligman answered 12/10, 2015 at 2:18 Comment(4)
Just had same issue with a rather intricate maven project with 2017.2.1. Why does this help?Woodnote
This just fixed a problem I had when upgrading from 2019.1.2 to 2019.2.1; so whatever is going on, it is still an issue.Arvizu
In IntelliJ 2019.3 the menu item I found was 'Build Module <project module name>'.Stakeout
I'm on IntelliJ and I can not find the option to 'Make Module'. Thanks, tho'.Eosinophil
S
41

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

Spracklen answered 29/9, 2016 at 8:57 Comment(6)
unbelieveable, I have spent days trying to sort this problem out and tried a million things but finally your solution worked for me ! thank you. For info I am using Intellij 2018.3, java 11 (but only using version 8 language level in my project), maven 3.6. Update : Although this works - there is something strange going on - after I run Rebuild Project and then run my "mvn clean", "mvn validate", "mvn compile" - I sometimes still get the error mentioned above.Dyspepsia
I think this helped me on 2019.2.2 (Ultimate Edition) for Mac.Jaworski
I had the same issue when after update to 2019.3 on Ubuntu. After rebuilding the project the problems are gone nowHigh
Thank you, this simple step helped me too on 2021.2.2 (Community Edition) for Linux!Watery
It didn't for me. Thanks, tho'.Eosinophil
Just to verify that this helped when upgrading from 23.x to 24.x!Vd
F
12

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

Forworn answered 16/6, 2022 at 7:49 Comment(0)
C
7

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

Comb answered 23/3, 2020 at 20:25 Comment(2)
Thanks. But it was already unchecked for me, so didn't work.Eosinophil
This did the trick for me :)Na
M
3

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

Macron answered 14/3, 2019 at 22:18 Comment(1)
I'm on intelliJ and can not not find the option to 'Open Module Settings'.Eosinophil
C
2

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.

Coulometer answered 27/8, 2015 at 11:18 Comment(2)
Thanks for your reply, I see. I am gonna try it but two questions: 1. how do I know it originates from line 43 and 2. Where can I see it needs configuration.xml? Thank you!Protactinium
To your questions: 1. line 43 reads context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, "Maven project configuration required for module '" + target.getModule().getName() + "' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE."));, which pretty much is the error message you get. And 2. you find that when you descend into JpsMavenExtensionService.getInstance().getMavenProjectConfiguration.Coulometer
S
2

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

Soll answered 19/10, 2017 at 14:57 Comment(0)
C
1

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.

Chimene answered 19/4, 2017 at 13:0 Comment(0)
D
1

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.

Death answered 6/7, 2017 at 17:2 Comment(0)
S
1

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.

Scorpion answered 27/8, 2018 at 17:18 Comment(0)
C
1

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

Chapman answered 15/10, 2019 at 15:9 Comment(0)
L
1

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

Latoria answered 20/6, 2021 at 17:59 Comment(0)
R
0

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

Rigidify answered 9/10, 2015 at 5:24 Comment(0)
T
0

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.

Tee answered 30/6, 2016 at 8:48 Comment(0)
C
0

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.

Cousingerman answered 28/10, 2021 at 11:24 Comment(0)
F
0

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.

Frodin answered 4/11, 2021 at 4:46 Comment(0)
L
0

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.

Lanalanae answered 14/12, 2021 at 8:17 Comment(0)
W
0

Rebuild the Project:

  • Go to the menu bar and click on Build.
  • Select Rebuild Project. This often resolves the issue.
Wheelbase answered 7/6 at 3:28 Comment(0)
C
-2
  • Go to event log and from there you will see options, what need to fix it
Concision answered 19/8, 2022 at 14:25 Comment(1)
thanks that really helped to fix it! /sUmbel

© 2022 - 2024 — McMap. All rights reserved.