java - 模块所需的 Maven 项目配置不可用

标签 java maven jsp intellij-idea tomcat8

我有一个在 Tomcat 8 服务器上运行的 Java/Maven/JSP。项目结构如下,

enter image description here

我在下面提供了这个 pom.xml 文件,

<?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.puut.wallet</groupId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <artifactId>WalletApp</artifactId>
    <name>simple-bitcoin-wallet</name>

    <parent>
        <groupId>org.bitcoinj</groupId>
        <artifactId>bitcoinj-parent</artifactId>
        <version>RELEASE</version>
    </parent>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
            </resource>
        </resources>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.bitcoinj</groupId>
            <artifactId>bitcoinj-core</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.20</version>
        </dependency>
        <dependency>
            <groupId>net.glxn</groupId>
            <artifactId>qrgen</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

当我运行项目时,出现以下错误,

Error:Maven Resources Compiler: Maven project configuration required for module 'WalletApp' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE.

我采取了一些措施,

a. in the terminal, run `mvn clean`
b. project -> right click -> `Make Module WalletApp`
c. project -> right click -> `Recompile Module WalletApp`
d. File -> Invalide Caches/Restart .... [This restarts the project]
e. Synchronize 

显然,他们都没有解决问题。顺便说一下,我在项目中使用 InteliIJ。我应该怎么做才能解决这个问题?

最佳答案

Event Log 中,我可以选择Add as maven project。我选择了那个选项,问题立即得到解决。

enter image description here

关于java - 模块所需的 Maven 项目配置不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44253254/

相关文章:

java - 如何从jsp调用servlet

Javascript 如何在 JSP 上使用带有两个提交按钮的确认对话框 onSubmit

java - JVM 中运行的默认线程数是多少?

java - 来自 MYSQL DB 查询的编码字符串在 Java 中被破坏

java - Maven Struts/JSP 登录注销示例应用程序?

java - Allure 框架 : TestNG adapter generates duplicate XML files

java - JSP 使用服务器时区显示服务器日期和时间

java - 如何查看 double 是否包含给定的整数?

转义引号的 Java 库

scala - 当加特林负载测试表现不佳时如何使 Jenkins 工作失败