分享

Maven使用tomcat8

 昵称27831725 2017-11-30

在网上搜索一堆文章没找到解决方法,只找到了tomcat7-maven-plugin的plugin,如下:


  1. <plugin>  
  2.   <groupId>org.apache.tomcat.maven</groupId>  
  3.   <artifactId>tomcat7-maven-plugin</artifactId>  
  4.   <version>2.2</version>  
  5. </plugin>  

并没有找到tomcat8-maven-plugin的plugin,在Maven的中央仓库中根本就没有这个插件:


https://repository./content/repositories/snapshots/org/apache/tomcat/maven/




在mvnrepository仓库中找到了一个






把上面的依赖加入到POM.XML中要么就是提示找不到该依赖,要么就是下载不下来.找了半天找到了一个解决方法,就是使用Maven中的<pluginRepositories> ,<pluginRepositories>是用来配置插件地址的,因为maven的所有功能都是使用插件来实现功能的,因此需要从特定的地址下载插件包。


在POM.XML中加入以下内容

  1. <pluginRepositories>     
  2.  <pluginRepository>     
  3. <id>alfresco-public</id>      
  4. <url>https://artifacts./nexus/content/groups/public</url>     
  5.  </pluginRepository>      
  6.  <pluginRepository>     
  7. <id>alfresco-public-snapshots</id>      
  8. <url>https://artifacts./nexus/content/groups/public-snapshots</url>      
  9. <snapshots>     
  10.   <enabled>true</enabled>      
  11.   <updatePolicy>daily</updatePolicy>     
  12. </snapshots>     
  13.  </pluginRepository>      
  14.  <pluginRepository>     
  15. <id>beardedgeeks-releases</id>      
  16. <url>http://beardedgeeks./svn/repository/releases</url>     
  17.  </pluginRepository>     
  18. </pluginRepositories>   

加入tomcat8-maven-plugin依赖

  1. <plugin>  
  2.   <groupId>org.apache.tomcat.maven</groupId>  
  3.   <artifactId>tomcat8-maven-plugin</artifactId>  
  4.   <version>3.0-r1655215</version>  
  5. </plugin>  

然后就能使用tomcat8-maven-plugin插件了。


然后在网上还找到了几个有这个插件的仓库:


http:///artifact/org.apache.tomcat.maven/tomcat8-maven-plugin/3.0-r1655215

https://svn./repos/asf/tomcat/maven-plugin/branches/tc8.x/

https://github.com/apache/tomcat-maven-plugin


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多