0

I've been reading around on this site and others, trying to figure out how add these external jars without doing mvn install, and haven't had any success. I was reading somewhere that maven-shade could address my problem, but I could never get that to work? I know spring boot doesn't like system scope but it seems to error out if I choose something else?

<?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>

    <groupId>org.springframework</groupId>
    <artifactId>gs-rest-service</artifactId>
    <version>0.1.0</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.3.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
       ...
        <dependency>
              <groupId>sample</groupId>  
               <artifactId>com.sample</artifactId>  
               <version>1.0</version> 
              <scope>system</scope>
              <systemPath>${project.basedir}/src/main/resources/lib/enterprise.jar</systemPath>
        </dependency>
        <dependency>
              <groupId>sample1</groupId>  
               <artifactId>com.sample1</artifactId>  
               <version>1.0</version> 
              <scope>system</scope>
              <systemPath>${project.basedir}/src/main/resources/lib/gs.jar</systemPath>
        </dependency>
        <dependency>
              <groupId>sample2</groupId>  
               <artifactId>com.sample2</artifactId>  
               <version>1.0</version> 
              <scope>system</scope>
              <systemPath>${project.basedir}/src/main/resources/lib/Util.jar</systemPath>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-io</artifactId>
    <version>1.3.2</version>
</dependency>



    </dependencies>

    <properties>
        <java.version>1.8</java.version>
        <start-class>ves.sfdc.Application</start-class>
    </properties>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>



</project>
J. Zhang
  • 157
  • 2
  • 2
  • 9
  • Pretty ugly to have jar files in arc/resources but it should end up in the JAR. What actually happens, build error or are the files just missing? – eckes Apr 27 '17 at 00:45
  • Can you specify what you mean by "without install"? – eckes Apr 27 '17 at 00:45
  • i mean without doing 'mvn install'. but i think i figured out how to configure our system right to run window shells commands so this is more or less resolved at my end. And yeah those resources just didn't end up in my jar, which when you ran the jar, it errors out for missing resources. – J. Zhang Apr 28 '17 at 01:51
  • hm... now I dont understand the question even less :) but good that it is resolved. – eckes Apr 28 '17 at 02:28

1 Answers1

1

You can create a new directory "lib" on your project, put your jars in this directory and then add them to your classpath.

If your IDE is IntelliJ you can follow this link:

Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

If you use another IDE you have to find on google how to add jar on your project classpath.