0

I have custom library which I want to push to my local repository using maven install plugin. I want maven-install-plugin to push this .jar - just as if I would use this command:

mvn install:install-file -Dfile=custom.jar -DgroupId=test -DartifactId=test -Dversion=1.0 -Dpackaging=jar

To achieve this, I created the following pom.xml:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-install-plugin</artifactId>
   <version>2.3.1</version>
   <executions>
       <execution>
           <id>smart-card-library-packaging</id>
           <phase>install</phase>
           <goals>
               <goal>install-file</goal>
           </goals>
           <configuration>
               <file>resources/test.jar</file>
               <groupId>test</groupId>
               <artifactId>test</artifactId>
               <version>1.0</version>
               <packaging>jar</packaging>
           </configuration>
       </execution>
   </executions>
</plugin>

However, I noticed that when I try to use mvn install:install-file -Dfile=custom.jar -DgroupId=test -DartifactId=test -Dversion=1.0 -Dpackaging=jar - then the original file (test.jar) is pushed to the repository as it is. And when I user the plugin, it actually creates another test.jar which contains the original one. So the original one is under test-1.0.jar/test.jar and test-1.0.jar is pushed to my repo. However, this is not what as I need just to push the original file to the repo (as if I were running the script above). I tried to remove <packaging> tag but maven gave an error <packaging> should be defined. Could someone please give a hint about what's wrong with my configuration?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Andrey Yaskulsky
  • 2,458
  • 9
  • 39
  • 81
  • I just tested on a sample project and I can't reproduce your error. With this config `test.jar` gets correctly installed as `test-0.1.jar` and its content is the same as the content of the original JAR file. Try to remove your `~/.m2/repository/test/test` folder and try again. – Tunaki Aug 14 '16 at 13:18
  • @Tunaki thanks for watching this issue on Sunday evening, I actually noticed that I have another outside of the tag, so that was the reason :-( I guess I'll close the issue – Andrey Yaskulsky Aug 14 '16 at 13:23
  • Great that you found the issue then :) – Tunaki Aug 14 '16 at 13:25
  • @Tunaki thanks very much for your effort – Andrey Yaskulsky Aug 14 '16 at 13:28

0 Answers0