0

Currently I'm having the problem that I have an Java project which was created with eclipse and which should now be builded with maven. I haven't created this project I just need to migrate it. The problem here is that I have a bunch of 3rd party jar's which need to be included to properly build the project. I know nothing about these jars (and I actually don't care what they do and where the came from).

I managed to find resources on how to add these jar's via command line to ma local repro and I further created a pom.xml which does the job for me (so I don#t need to use the command line) but somehow its not working properly. I doen't matter if I use the command line or the pom.xmo, non of the two approaches works for me. When i run the pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>common</groupId>
      <artifactId>common.master</artifactId>
      <relativePath>../pom.xml</relativePath>
      <version>1.0.0-SNAPSHOT</version>
   </parent>
   <groupId>common</groupId>
   <artifactId>org.proj4j</artifactId>
   <name>org.proj4j</name>
   <version>0.1.0</version>
   <packaging>jar</packaging>
   <build>
      <sourceDirectory>src/</sourceDirectory>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
               <source>${jdk.version}</source>
               <target>${jdk.version}</target>
            </configuration>
         </plugin>
<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.4</version>
          <executions>
            <execution>
              <id>install1</id>
              <phase>package</phase>
              <goals>
                <goal>install-file</goal>
              </goals>
              <configuration>
                <file>proj4j-0.1.0.jar</file>
                <groupId>common</groupId>
                <artifactId>org.proj4j</artifactId>
        <name>proj4j</name>
                <version>0.1.0</version>
        <packaging>jar</packaging>
              </configuration>
            </execution>
            <execution>
              <id>install2</id>
              <phase>package</phase>
              <goals>
                <goal>install-file</goal>
              </goals>
              <configuration>
                <file>proj4j-support-0.1.0.jar</file>
                <groupId>common</groupId>
                <artifactId>org.proj4j</artifactId>
        <name>proj4j-support</name>
                <version>0.1.0</version>
        <packaging>jar</packaging>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
   </build>
</project>

the jars are put into my local repro under the specified group id, artifact ID etc. But the compiler still fails with an Unknown Symbol Error which says that the required class could not be found during compilation. I guess the reason are the artifact ID and the group ID because I came up with them. They are not related to my 3rd party jars at all. But I also don't know the proper group ID / artifact ID's because i know nothing about the jars. They are also partially self written by colleges.

What can I do to make maven find the required libs and to resolve all missing classes. Like I already said, with eclipse everything runs fine and without any problems. Shouldn't it be possible put the jar somehow into one folder in my local repro and tell the compiler If you search for anything start looking here ?

Westranger
  • 1,199
  • 15
  • 27

2 Answers2

1

See if one of the below works for you:

How to add local jar files in maven project?

Maven: add a dependency to a jar by relative path let me know if it helps

They explain in details what needs to be done..

Community
  • 1
  • 1
ivoruJavaBoy
  • 1,176
  • 14
  • 36
0

You can put your jar manually in your repo. You dont must know nothing about this jars, the artifact-id and the group-id affect the route in the repo and the name of the dependencie that compiler will look for.

I recommend you add some dependencie that exists in maven repo and observe the route and name of file that the pom creates in your local repo, after that sure you look the way that pom.xml works.

Mikel
  • 165
  • 14