суббота, 9 февраля 2013 г.

MAVEN: Установить jar в локальный репозиторий

 mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \ -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>  

Здесь подробнее по параметрам.

Установить jar в локальный репозитарий:

 mvn install:install-file -Dfile=mylib-1.0.jar -DgroupId=com.lotos -DartifactId=mylib -Dversion=1.0 -Dpackaging=jar  

Установить jar в локальный репозиторий внутри проекта:

mvn install:install-file -Dfile=mylib-1.0.jar -DgroupId=com.lotos -DartifactId=mylib  -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=/path_to_project/lib/
И добавить в pom.xml:
 .............  
 <repositories>  
   <repository>  
     <id>localrepo</id>  
     <url>file://${basedir}/lib</url>  
   </repository>  
 </repositories>  
 <dependencies>  
   <dependency>  
     <groupId>com.lotos</groupId>  
     <artifactId>mylib</artifactId>  
     <version>1.0</version>  
 </dependency>  
   ..............  
 </dependencies>  
 ..........  

Другой вариант -- просто использовать system scope:

 <dependencies>  
   <dependency>  
     <groupId>com.lotos</groupId>  
     <artifactId>mylib</artifactId>  
     <version>1.0</version>  
     <scope>system</scope>  
     <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/mylib-1.0.jar</systemPath>  
   </dependency>  
 .........  
   <dependencies>  

но при этом будут выдаваться предупреждение вроде такого:
 [WARNING] Some problems were encountered while building the effective model for **apk:1.0 [WARNING] 'dependencies.dependency.systemPath' for com.loopj.android.http:android-async-http:jar should not point at files within the project directory, ${project.basedir}/libs/android-async-http-1.3.2.jar will be unresolvable by dependent projects @ line 36, column 25  

1 комментарий:

Анонимный комментирует...

Добрый день, Александр.
Мой коммент немножко не по теме. Я занимаюсь разработкой фильтрующих драйверов, в частности ndis. Наткнулся на вашу статью http://winkernel.blogspot.com/2008/09/ndis-msi-wix.html об альтернативных способах установки ndis фильтров. У меня возникло пару вопросов и хотелось бы пролить хоть чуточку света на них. Если вам несложно, то лучше через почту. Вот мой ящик: alexandr.gerbedz@gmail.com.

Буду очень признателен.
Гербедь Александр.