java - 部署 jar Tomcat 8

标签 java spring tomcat deployment

我很久没有开发了。

现在我又开始开发了。我已经构建了 spring boot 应用程序,但不幸的是在 Intellij 中的“Maven:Install”之后将文件复制到 Tomcat 8,Tomcat 没有部署该应用程序。

在 server.xml 中我有 autoDeploy="true"

pom.xml 中的构建部分是:

<build>
    <finalName>ROOT</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                </additionalProjectnatures>
                <additionalBuildcommands>
                    <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                </additionalBuildcommands>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </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>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <mainClass>org.test.int1.Main</mainClass>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Tomcat 当然可以正常工作。

在 catalina 中没有任何信息,tomcat 正在尝试部署 - 完全没有。

你能支持我吗,我忘记了什么?

最佳答案

如果你开发一个spring boot应用,你不需要拷贝文件到tomcat。 您只需运行生成的 jar 文件:

'java -jar jarFileName.jar'

并将启动应用程序。 tomcat包含在jar文件中

关于java - 部署 jar Tomcat 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52493707/

相关文章:

扫描仪上的 Java 问题(未找到线路)我该如何解决这个问题?

Java 绑定(bind)与手动定义类

java - 在 Spring Boot 项目中声明同一类/DAO 的多个实例是否有害?

java - 使用现有的 Servlet 类或 JSP - Servlet 列表为空

spring-boot - spring boot 自定义错误页面在服务器上部署时不呈现

java - 服务器-客户端应用程序中的 Spring Data 分页

java - 在 Java 中使用 HikariCP 时如何指定数据库特定属性?

java - 如何将源链接到 Intellij 中的项目,使 tomcat 能够使用类文件? (就像在 eclipse 中一样)

java - 调试 AngularJS + Spring MVC + Tomcat Web 应用程序

java - 匹配字符串的模式