0

Here is my pom.xml with my location to a JAR in my PC.

<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>net.onima</groupId>
  <artifactId>onimaapi</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>OnimaAPI</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
  </properties>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.zaxxer</groupId>
      <artifactId>HikariCP</artifactId>
      <version>2.7.8</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.github.paperspigot</groupId>
      <artifactId>paperspigot</artifactId>
      <version>1.7.10-R0.1-SNAPSHOT</version>
      <scope>system</scope>
      <systemPath>C:\Users\Jules\Desktop\Serveur Local\paperspigot-1.7.10-R0.1-SNAPSHOT.jar</systemPath>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <configuration>
          <filters>

            <filter>
              <artifact>com.zaxxer:HikariCP</artifact>
              <includes>
                <include>**</include>
              </includes>
            </filter>


          </filters>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

When I set the filter so I can add HikariCP into my jar, the dependency related to my jar in my PC removes, so I can't clean install. I don't understand why, can someone explain for me? I'm quite new to maven and still struggle with it.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Jules
  • 346
  • 1
  • 3
  • 15
  • May I ask what is the objective that you are trying to achieve? Based on the maven documentation, https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html, the filter attribute is used to include a file of user-variables into the project. – Timothy T. Jan 14 '19 at 03:07
  • Yes my goal is to include HikariCP (and so slf4j) in my jar – Jules Jan 14 '19 at 14:07
  • Do you know how to fix this @TimothyT. – Jules Jan 14 '19 at 21:07
  • There is a thread here from someone who was trying to achieve the same thing: https://stackoverflow.com/questions/1729054/including-dependencies-in-a-jar-with-maven See if this works for you. – Timothy T. Jan 15 '19 at 01:58
  • I didn't find any solution. I did something that works but it's a bit "tricky". I downloaded the lib I didn't want in my jar and set it as a dependency with the systemPath variables. Then I'm using maven fat jar plugins. – Jules Jan 15 '19 at 03:28

0 Answers0