【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
为什么通过eclipse的export导出的war可以复制到tomcat下直接部署,但是通过maven的instal打包的war部署到tomcat后却访问不到???
pom.xml配置如下:
<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.lanxum</groupId>
<artifactId>project_xt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- 版本管理 -->
<properties>
<activiti.version>5.16.1</activiti.version>
<spring.version>4.2.6.RELEASE</spring.version>
<hibernate.version>5.1.0.Final</hibernate.version>
<!-- 根据自己jdk位置配置 -->
<java.home>C:\Program Files\Java\jdk1.7.0_67</java.home>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<!--这里说明jsp-api.jar文件将由应用服务器提供,打包时不需要包含-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>src\main\webapp\WEB-INF\lib</extdirs>
<verbose />
<bootclasspath>${java.home}\jre\lib\rt.jar;${java.home}\jre\lib\jce.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- 重点是这个配置 -->
<warName>project_xt</warName>
</configuration>
</plugin>
</plugins>
</build>
</project>
项目架构之前是普通的web项目我给转为了maven web ,现在jar主要还是直接复制到lib目录下~
配置有问题,你把需要的jar都配置好,容器自己已经有的jar配置scope为provide,build节点里面的配置看看其他的配置,反正不正确,配置了一些不需要的,另外需要配置打包的文件名。
需要生成war的时候使用命令