我正在使用 Maven 3.3.3 创建一个可以部署到 Heroku 的 Spring MVC 应用程序。我打算按照 Heroku 文档 ( https://devcenter.heroku.com/articles/getting-started-with-spring-mvc-hibernate ) 的建议使用 jetty-runner。
我无法让 Maven 创建用于复制 jetty-runner.jar 文件的目标/依赖文件夹。我使用命令:
mvn clean
mvn package
我创建了目标目录,其中包含所有资源、网页和源代码,但没有包含应复制 jetty-runner.jar 文件的“target/dependency”文件夹。
我的 pom.xml 与上面链接中示例应用程序提供的几乎相同。我的项目和 pom.xml 文件可以在以下 GitHub 存储库中找到:
最佳答案
在 <pluginManagement>
的之外 添加依赖插件的激活部分:
...
<build>
<pluginManagement>
<plugins>
<!-- Leave as is -->
...
</plugins>
</pluginManagement>
<!-- Add the section below -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>
...
<pluginManagement>
部分用于声明您的插件在 激活时的行为。激活本身是在本节之外完成的。
关于java - 未在目标中创建 Maven 依赖目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33794687/