码迷,mamicode.com
首页 > 编程语言 > 详细

maven 工程下第三方jar 包的引入和打包 war

时间:2018-10-19 17:39:36      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:出错   pac   alt   http   tor   位置   ext   current   问题   

有时我们需要第三方jar 放在lib 包下

-------位置:/WEB-INF/lib 

报编译出错,此时:

技术分享图片

然后在打包war 发现问题 

pom.xml  中引入

${basedir}为pom内置的元素
<!--maven 将lib 下包打成war 包-->
          <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                  <encoding>UTF-8</encoding>
                  <compilerArguments>
                      <!-- <extdirs>${basedir}/WebRoot/WEB-INF/lib</extdirs> -->
                      <extdirs>${basedir}/src/main/webapp/WEB-INF/lib</extdirs>
                  </compilerArguments>
              </configuration>
          </plugin>
        <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
        <!--引入第三方jar 包-->
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.2.0</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>${basedir}/src/main/webapp/WEB-INF/lib</directory> <targetPath>WEB-INF/lib</targetPath> 

              <includes>
              
<include>**/*.jar</include>
   
               </includes> </resource>
      
              </webResources> </configuration>

            </plugin>

 

maven 工程下第三方jar 包的引入和打包 war

标签:出错   pac   alt   http   tor   位置   ext   current   问题   

原文地址:https://www.cnblogs.com/jsbk/p/9817492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!