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 Spring启动应用程序-Tomcat部署_Maven_Tomcat_Spring Boot_Web Deployment - Fatal编程技术网

Maven Spring启动应用程序-Tomcat部署

Maven Spring启动应用程序-Tomcat部署,maven,tomcat,spring-boot,web-deployment,Maven,Tomcat,Spring Boot,Web Deployment,我在将spring boot应用程序部署到tomcat时遇到问题,尽管它在IDE中运行良好。 我听从了老师的指示 但结果是,我得到了一个war包,其中只包含框架库和web类,而我的核心模块中没有任何内容 我不确定我的pom文件是否正确 我的项目结构如下所示: portal -web -src pom1.xml -core -src pom2.xml pom0.xml 项目pom(pom0.xml): mvn clear软件包

我在将spring boot应用程序部署到tomcat时遇到问题,尽管它在IDE中运行良好。 我听从了老师的指示

但结果是,我得到了一个war包,其中只包含框架库和web类,而我的核心模块中没有任何内容

我不确定我的pom文件是否正确

我的项目结构如下所示:

portal  
   -web 
     -src
     pom1.xml
   -core  
     -src  
     pom2.xml  
pom0.xml
项目pom(pom0.xml):

mvn clear软件包给出了该错误:

[INFO] portal ............................................. SUCCESS [  0.700 s]  
[INFO] core ............................................... SUCCESS [  2.478 s]  
[INFO] web ................................................ FAILURE [  0.458 s]  
[INFO] tests .............................................. SKIPPED  
...  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project web: Compilation failure: Compilation failure:  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[4,37] package com.portal.core.domain does not exist  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[5,38] package com.portal.core.service does not exist  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[18,19] cannot find symbol  
[ERROR] symbol:   class IIncidentService  
[ERROR] location: class com.portal.web.controller.IncidentController  
...  
将“web模块”添加到父“门户模块”的模块部分:


核心
应用程序编程接口
测验
网状物

在父“门户模块”的文件夹中运行
mvn clean package

多模块项目的解决方案是配置Boot的重新打包以将分类器应用于jar:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                    <configuration>
                        <classifier>exec</classifier>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

org.springframework.boot

谢谢你的回答。这是一个输入错误,模块web存在于父文件夹的模块中。我更新了我在执行mvn clean包后遇到的错误问题。
 <parent>
    <artifactId>portal</artifactId>
    <groupId>com.portal</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>core</artifactId>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <dependency>
        <groupId>com.custom.api</groupId>
        <artifactId>common-utils</artifactId>
        <version>1.1</version>
    </dependency>
</dependencies>
-web  
  -com.portal.web 
   -controller  
    IncidentController  
    ComputerController
    ...  
-core  
 -com.portal.core  
   -domain  
    Incident  
    Computer  
    ...
[INFO] portal ............................................. SUCCESS [  0.700 s]  
[INFO] core ............................................... SUCCESS [  2.478 s]  
[INFO] web ................................................ FAILURE [  0.458 s]  
[INFO] tests .............................................. SKIPPED  
...  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project web: Compilation failure: Compilation failure:  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[4,37] package com.portal.core.domain does not exist  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[5,38] package com.portal.core.service does not exist  
[ERROR] /.../portal/web/src/main/java/com/portal/web/controller/IncidentController.java:[18,19] cannot find symbol  
[ERROR] symbol:   class IIncidentService  
[ERROR] location: class com.portal.web.controller.IncidentController  
...  
<modules>
  <module>core</module>
  <module>api</module>
  <module>tests</module>
  <module>web</module>
</modules>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                    <configuration>
                        <classifier>exec</classifier>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>