在建项目时路径都设置好了,为什么在eclipse中运行maven项目时jar包没有到lib目录下,WEB-INF/lib是空的。
2个回答
展开全部
修改pom文件 增加copy 命令
<properties>
<pro.outerDirectory>src/main/webapp</pro.outerDirectory>
</properties>
<!-- package阶段,把jar包放到WEB-INF/lib下面,便于与eclipse联合使用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${pro.outerDirectory}/WEB-INF/lib</outputDirectory>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<properties>
<pro.outerDirectory>src/main/webapp</pro.outerDirectory>
</properties>
<!-- package阶段,把jar包放到WEB-INF/lib下面,便于与eclipse联合使用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${pro.outerDirectory}/WEB-INF/lib</outputDirectory>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询