maven copy jar 插件


 插件比较特殊 eclipse下的 首先声明插件
  1. <pluginManagement>
  2. <plugin>
  3. <groupId>org.apache.maven.plugins</groupId>
  4. <artifactId>maven-compiler-plugin</artifactId>
  5. <configuration>
  6. <source>1.6</source>
  7. <target>1.6</target>
  8. </configuration>
  9. </plugin>
  10. <plugin>
  11. <groupId>org.eclipse.m2e</groupId>
  12. <artifactId>lifecycle-mapping</artifactId>
  13. <version>1.0.0</version>
  14. <configuration>
  15. <lifecycleMappingMetadata>
  16. <pluginExecutions>
  17. <pluginExecution>
  18. <pluginExecutionFilter>
  19. <groupId>org.apache.maven.plugins</groupId>
  20. <artifactId>maven-dependency-plugin</artifactId>
  21. <versionRange>[2.0,)</versionRange>
  22. <goals>
  23. <goal>copy-dependencies</goal>
  24. </goals>
  25. </pluginExecutionFilter>
  26. <action>
  27. <ignore />
  28. </action>
  29. </pluginExecution>
  30. </pluginExecutions>
  31. </lifecycleMappingMetadata>
  32. </configuration>
  33. </plugin>
  34. </plugins>
  35. </pluginManagement>

引入自定义插件

  1. <plugins>
  2. <!-- remove jar plugins -->
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-clean-plugin</artifactId>
  6. <executions>
  7. <execution>
  8. <id>clean</id>
  9. <phase>install</phase>
  10. <goals>
  11. <goal>clean</goal>
  12. </goals>
  13. <configuration>
  14. <directory>/src/main/webapp/WEB-INF/lib</directory>
  15. </configuration>
  16. </execution>
  17. </executions>
  18. </plugin>
  19. <!-- copy jar plugins -->
  20. <plugin>
  21. <groupId>org.apache.maven.plugins</groupId>
  22. <artifactId>maven-dependency-plugin</artifactId>
  23. <executions>
  24. <execution>
  25. <id>copy-dependencies</id>
  26. <phase>package</phase>
  27. <goals>
  28. <goal>copy-dependencies</goal>
  29. </goals>
  30. <configuration>
  31. <outputDirectory>src/main/webapp/WEB-INF/lib</outputDirectory>
  32. <excludeTransitive>false</excludeTransitive>
  33. <stripVersion>false</stripVersion> <!-- 复制jar 的时候去掉版本信息 true : 去掉 false: 不去掉 -->
  34. <includeScope>runtime</includeScope>
  35. </configuration>
  36. </execution>
  37. </executions>
  38. </plugin>

posted on 2017-03-24 08:56  signheart  阅读(669)  评论(0编辑  收藏  举报

导航