欢迎访问我的个人网站==》 jiashubing.cn

maven使用systemPath方式加载本地jar(代码库)

比如,jar包直接放到根目录

 

pom.xml 里这么配置

<dependency>
   <groupId>njcanc</groupId>
   <artifactId>njcanc</artifactId>
   <version>2.12</version>
   <scope>system</scope>
   <systemPath>
      ${project.basedir}/jar/njcanc-2.12.jar
   </systemPath>
</dependency>

 

打包的时候也要包含一下

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.4</version>
   <configuration>
      <includeEmptyDirectories>
         true
      </includeEmptyDirectories>
      <webResources>
         <resource>
            <directory>
               ${project.basedir}/jar
            </directory>
            <targetPath>WEB-INF/lib</targetPath>
            <filtering>false</filtering>
            <includes>
               <include>**/*.jar</include>
            </includes>
         </resource>
      </webResources>
   </configuration>
</plugin>

 

posted @ 2024-02-26 13:50  贾树丙  阅读(164)  评论(0编辑  收藏  举报