Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行父maven项目时获取war模块_Maven - Fatal编程技术网

运行父maven项目时获取war模块

运行父maven项目时获取war模块,maven,Maven,当我运行父项目时,有没有办法自动运行war模块? 为了明确起见,我做了三个独立的maven项目(db、core和presentation),然后我做了一个父项目,其中包括前面提到的3个项目。 我希望在运行父项目时运行演示模块 另外,我想知道是否有可能将洞工作从父项目保存到我的git帐户 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins

当我运行父项目时,有没有办法自动运行war模块? 为了明确起见,我做了三个独立的maven项目(db、core和presentation),然后我做了一个父项目,其中包括前面提到的3个项目。 我希望在运行父项目时运行演示模块

另外,我想知道是否有可能将洞工作从父项目保存到我的git帐户

     <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.project.xxxxxxx</groupId>
  <artifactId>parent-project</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>parent-project</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <targetJdk>1.7</targetJdk>
   </properties>

  <build>

        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <port>8080</port>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${targetJdk}</source>
                    <target>${targetJdk}</target>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <modules>
        <module>../project-db</module>
        <module>../project-core</module>
        <module>../project-presentation</module>
    </modules>


  <dependencies>

  </dependencies>
</project>

4.0.0
com.project.xxxxxxx
父项目
0.0.1-快照
聚甲醛
父项目
http://maven.apache.org
UTF-8
1.7
org.apache.tomcat.maven
tomcat7 maven插件
2
8080
org.apache.maven.plugins
maven编译器插件
${targetJdk}
${targetJdk}
符合事实的
../project db
../项目核心
../项目介绍

您需要在标记下指定子项目。
例如,您可以参考文件结构中的模块应与父模块卸载。像

  • 父项目
    • pom.xml
    • 项目数据库
      • pom.xml
    • 项目核心
      • pom.xml
    • 项目介绍
      • pom.xml
然后您必须更改父pom:

<modules>
    <module>project-db</module>
    <module>project-core</module>
    <module>project-presentation</module>
</modules>

项目数据库
项目核心
项目介绍

你能提供你的父项目的
pom.xml
吗?@Ria我刚刚将pom文件添加到我的帖子中,可以像我做的那样和你上面提到的那样做,我的解决方案工作得很好。问题仍然是如何在运行父项目时直接运行演示项目。对不起,这是我的错。我没有仔细阅读这个问题。演示模块是一场战争,对吗?您想在tomcat、jetty或其他服务器上对其进行tun吗。演示模块是一个war,当我直接运行它时,它可以工作。我正在Tomcat7上运行我的项目,所有子项目都在标记下指定。我的应用程序运行时没有错误。我需要知道的是,当我运行父项目而不是运行表示模块时,如何获取表示层(一个网页)。