2

我在我的 Spring Boot 应用程序中使用嵌入式 tomcat。我调整应用程序的目标如下:

clean spring-boot:run

它运行没有错误。我使用eclipse关闭按钮将其关闭。我第二次尝试运行它,我得到了这个:

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project cpanel: Failed to clean project: Failed to delete XXXXXXXXX\target\classes\hibernate\security\user\User.hbm.xml -> [Help 1]

它模拟tomcat下次无法删除目标。我的tomcat怎么了?难道我做错了什么?

我在 application.yml 中的服务器配置:

server:
compression:
    enabled: true
port: 8080
servlet-path: /rest

和我的tomcat依赖:

<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <scope>provided</scope>
</dependency>
4

3 回答 3

3

要解决此问题,请更改tomcat maven plugin并添加forkfalse

   <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <fork>false</fork>
        </configuration>
  </plugin>
于 2016-05-17T17:05:26.263 回答
1

I wrote this bat script command:

FOR /F "tokens=5 delims= " %%P IN ('netstat -a -n -o ^| findstr :8080.*LISTENING') DO TaskKill.exe /PID %%P /F pause and saved it in killport.bat, then called it with maven-antrun-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <configuration>
                <target>
                    <exec executable="cmd.exe" spawn="true">
                        <arg value="/c" />
                        <arg value="F:\Java\Projects\killport.bat" />
                    </exec>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>
于 2016-12-26T15:53:25.527 回答
0

只需在 pom.xml 文件中的 spring-boot-maven-plugin 中添加以下 Tag

            <configuration>
                <fork>false</fork>
            </configuration>

这是完整的示例:

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <fork>false</fork>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
于 2020-08-23T13:35:02.820 回答