[API] Java API: How do I add dependencies to the classpath?
-
- KVRer
- Topic Starter
- 6 posts since 28 Oct, 2017
Hi,
where do I need to drop my dependencies (eg log4j) in order for the extension classloader to find them?
I tried creating a fat fat using maven shade, but I still get NoClassDefFoundError exceptions.
thanks,
felix
where do I need to drop my dependencies (eg log4j) in order for the extension classloader to find them?
I tried creating a fat fat using maven shade, but I still get NoClassDefFoundError exceptions.
thanks,
felix
- KVRAF
- 4146 posts since 13 May, 2004
Can you post your pom.xml?
-
- KVRer
- Topic Starter
- 6 posts since 28 Oct, 2017
Code: Select all
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mossgrabers</groupId>
<artifactId>DrivenByMoss</artifactId>
<packaging>jar</packaging>
<name>DrivenByMoss</name>
<version>LOCAL-23</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bitwig.extension.directory>/home/felix/Bitwig Studio/Extensions</bitwig.extension.directory>
</properties>
<repositories>
<repository>
<id>bitwig</id>
<name>Bitwig Maven Repository</name>
<url>https://maven.bitwig.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.bitwig</groupId>
<artifactId>extension-api</artifactId>
<version>5</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<optimize>true</optimize>
<fork>true</fork>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<maxmem>1024m</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>rename-file</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.build.directory}/${project.build.finalName}.jar</sourceFile>
<destinationFile>${bitwig.extension.directory}/DrivenByMoss.bwextension</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.bitwig:extension-api</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
<configuration>
<finalName>uber-${artifactId}-${version}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>
- KVRAF
- 4146 posts since 13 May, 2004
You need to run the shader before the copy plugin.