zoukankan      html  css  js  c++  java
  • 既使用maven又使用本地Jar包

    maven 使用本地包 lib jar包 依赖一个lib目录

    解决方法:

    1. 把本地的lib加入maven编译时的依赖路径

         如下配置:

         <plugin> 
                  <artifactId>maven-compiler-plugin</artifactId> 
                  <configuration> 
                      <source>1.6</source> 
                      <target>1.6</target> 
                      <encoding>UTF-8</encoding> 
                      <compilerArguments> 
                       <extdirs>lib/</extdirs> 
                     </compilerArguments> 
                  </configuration> 
                </plugin>
    

      

    2. 本地system 配置

       这种的不好处是,只能加入某个jar包而不是某个目录

    <dependency>
        <groupId>org.swinglabs</groupId>
        <artifactId>swingx</artifactId>
        <version>0.9.2</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/swingx-0.9.3.jar</systemPath>
    </dependency>
    

      

    3. 把jar包安装入本地仓库

      - 先安装jar包到本地仓库

      - 引用安装的jar包

          注意: 正规maven的方法,要求jar包中有合法的 artifactId信息

    <repository>
        <id>repo</id>
        <releases>
            <enabled>true</enabled>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>file://${project.basedir}/repo</url>
    </repository>

    4. 使用install  插件  (推荐使用)

         配置如下:

    <plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-install-plugin</artifactId>
    				<executions>
    					<execution>
    						<id>install-external</id>
    						<phase>clean</phase>
    						<configuration>
    							<file>${basedir}/lib/app-0.0.1.jar</file>
    							<repositoryLayout>default</repositoryLayout>
    							<groupId>com.dalong.locallib</groupId>
    							<artifactId>appbanner</artifactId>
    							<version>0.0.1</version>
    							<packaging>jar</packaging>
    							<generatePom>true</generatePom>
    						</configuration>
    						<goals>
    							<goal>install-file</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    

      

         

    5. 使用命令

       

    mvn install:install-file  -Dfile=D:/jar/xxx.jar  -DgroupId=xxx.xxx  -DartifactId=xxx -Dversion=x.x -Dpackaging=jar
    

      

         

  • 相关阅读:
    Commonjs规范 浏览器运行
    node Commonjs规范
    Node 支持ES6 modules
    node only 对象属性白名单
    babel 关键配置
    Linux测试硬盘读性能的常用工具-hdparm
    linux下/etc/profile、/etc/bashrc、~/.bashrc 和~/.bash_profile文件的区别
    storcli64和smartctl定位硬盘的故障信息
    数据库迁移的几种方式
    linux中截取字段与#、$区别
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/5959456.html
Copyright © 2011-2022 走看看