0

i found an good article on the internet that shows me how to add a jar library to my maven (eclipse) project, using "maven-install-plugin". i used this and managedd it to have the ucanaccess 3.0.1 library added to my maven project.

however, the source code is a separate zip file and i did not find any sufficient information on the internet how to add this source file "the same way" using "maven-install-plugin". i found some information that the plugin "somehow" supports the definition of sources, but i was unable to find WHERE and HOW the proper way is (no examples found).

Could someone please give me a Tip what a proper "maven-install-plugin" configuration in a pom.xml would look like including the SOURCE FILE ?

This is part of my pom.xml concerning the external library ucanaccess 3:

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-external</id>
                        <phase>clean</phase>
                        <configuration>
                            <file>${basedir}/externalLibs/UCanAccess-3.0.1-bin/ucanaccess-3.0.1.jar</file>
                            <repositoryLayout>default</repositoryLayout>
                            <groupId>net.ucanaccess</groupId>
                            <artifactId>ucanaccess</artifactId>
                            <version>3.0.1</version>
                            <packaging>jar</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

thanks

Axel Werner
  • 186
  • 1
  • 17

2 Answers2

1

I added UCanAccess to the maven central repository this week (it's my first time). Is there a reason to rebuild it from the source files? If not you shouldn't need any workaround but you could include it in your pom as any other dependency. The groupid is net.sf.ucanaccess the artifactid is ucanaccess. I'm an old italian man so any feedback about it would be very appreciated (maybe my seven year old daughter wouldn't have had the same trouble with maven).

jamadei
  • 1,700
  • 9
  • 8
  • +1 for "I'm an old italian man so any feedback about it would be very appreciated (maybe my seven year old daughter wouldn't have had the same trouble with maven)" – Sean Patrick Floyd Sep 23 '15 at 14:45
  • Thanks. Was about time. I'm using the central maven repo version now, so it does work and provides the source too. - but the question is not yet answered. I guess there must be a way to add the sources zip or jar to the maven install plugin somehow – Axel Werner Sep 24 '15 at 05:51
  • Thanks Axel for the feedback, it's because I don't know the answer but I wanted to be helpful anyway. I'll ask to my daughter when she comes back from school ;-) – jamadei Sep 24 '15 at 07:12
0

Use custom repository based on filesystem, like this:

<repositories>
  <repository>
  <id>local</id>
    <layout>default</layout>
    <url>file:///${project.basedir}/localrepo</url>
  </repository>
</repositories>

So Maven will look for the files in the local repo and the copy them to ~/.m2/repository

no additional plugins required. You just need to put the files into the correct folders, like localrepo/com/mypackage/something/library-1.0.jar

jdevelop
  • 12,176
  • 10
  • 56
  • 112