java - 导入maven项目但父模块被禁用

标签 java eclipse maven gwt pom.xml

我想将此项目导入到我的 ecplise 工作区中: https://github.com/steinsag/gwt-maven-example

该项目的结构是:

  1. gwt-maven-示例-master
    • pom.xml
    • 服务器
      • pom.xml
      • ...
    • 已共享
      • pom.xml
      • ...
    • 网络
      • pom.xml
      • ...

父pom:

<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>de.hpfsc</groupId>
    <artifactId>parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0-SNAPSHOT</version>

    <modules>
        <module>server</module>
        <module>shared</module>
        <module>web</module>
    </modules>

    <properties>
        <gwtVersion>2.5.0</gwtVersion>
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <tomcat.webport>8082</tomcat.webport>
        <tomcat.ajpport>8182</tomcat.ajpport>
        <tomcat.context>/parent</tomcat.context>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.0-rc2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <path>${tomcat.context}</path>
                    <port>${tomcat.webport}</port>
                    <ajpPort>${tomcat.ajpport}</ajpPort>
                    <systemProperties>
                        <JAVA_OPTS>-XX:MaxPermSize=256m</JAVA_OPTS>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

当我尝试将包含此 pom 的文件夹导入到 eclipse 中时,它允许我选择子文件夹,但不能选择父文件夹本身。

为什么无法导入父pom? 我尝试创建一个父文件夹,将 pom.xml 放入其中并使用 ../server 引用其他模块,但它不起作用。 我尝试从父pom中删除与tomcat配置相关的代码,但它也不起作用。

谢谢

最佳答案

您需要安装 m2e 插件(您可能已经安装了该插件,具体取决于 eclipse 的版本)。我想目前您正在执行“导入”然后“将现有项目导入工作区”,但您需要选择“现有 Maven 项目”。这将允许您选择父 pom 以及子模块。

关于java - 导入maven项目但父模块被禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20593921/

相关文章:

java - 无法理解以下错误 : "(Ljava/lang/Integer;)V" is not applicable on this object

java - 将 Eclipse JDT ITypeBinding 转换为类型

java - 正则表达式匹配偶数个括号

java - 让 xuggler 与 maven 一起工作

java - 当我在项目中添加新库时相关库的协调版本

java - 删除集成测试时创建 bean 的异常,该异常不会出现在标准应用程序启动中

eclipse - Datanucleus Maven 插件

java - 将 Zeromq 添加到 Github 上的现有 Java Gradle 项目

eclipse - 禁用 MercurialEclipse

maven - 并行下载Maven Artifact