mirror of
https://github.com/apache/activemq-artemis.git
synced 2025-02-08 19:15:08 +00:00
ARTEMIS-4444 Support custom directories to add runtime dependencies
The system property `artemis.extra.libs` is a comma separated list of directories that contains jar files, i.e. ``` -Dartemis.extra.libs=/usr/local/share/java/lib1,/usr/local/share/java/lib2 ``` The environment variable `ARTEMIS_EXTRA_LIBS` is a comma separated list of directories that contains jar files and is ignored if the system property `artemis.extra.libs` is defined, i.e. ``` export ARTEMIS_EXTRA_LIBS=/usr/local/share/java/lib1,/usr/local/share/java/lib2 ```
This commit is contained in:
parent
8d48f8a373
commit
7a55b1d613
@ -35,6 +35,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class Artemis {
|
public class Artemis {
|
||||||
|
|
||||||
|
public static final String EXTRA_LIBS_SYSTEM_PROPERTY = "artemis.extra.libs";
|
||||||
|
public static final String EXTRA_LIBS_ENVIRONMENT_VARIABLE = "ARTEMIS_EXTRA_LIBS";
|
||||||
|
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
String home = System.getProperty("artemis.home");
|
String home = System.getProperty("artemis.home");
|
||||||
|
|
||||||
@ -84,6 +87,16 @@ public class Artemis {
|
|||||||
dirs.add(new File(fileInstance, "lib"));
|
dirs.add(new File(fileInstance, "lib"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String extraLibs = System.getProperty(EXTRA_LIBS_SYSTEM_PROPERTY);
|
||||||
|
if (extraLibs == null) {
|
||||||
|
extraLibs = System.getenv(EXTRA_LIBS_ENVIRONMENT_VARIABLE);
|
||||||
|
}
|
||||||
|
if (extraLibs != null) {
|
||||||
|
for (String extraLib: extraLibs.split(",")) {
|
||||||
|
dirs.add(new File(extraLib));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<URL> urls = new ArrayList<>();
|
ArrayList<URL> urls = new ArrayList<>();
|
||||||
|
|
||||||
// Without the etc on the config, things like JGroups configuration wouldn't be loaded
|
// Without the etc on the config, things like JGroups configuration wouldn't be loaded
|
||||||
|
@ -532,10 +532,22 @@ NOTE: the environment variable `JAVA_ARGS_APPEND` can be used to append or overr
|
|||||||
|
|
||||||
Runtime dependencies like diverts, transformers, broker plugins, JDBC drivers, password decoders, etc. must be accessible by the broker at runtime.
|
Runtime dependencies like diverts, transformers, broker plugins, JDBC drivers, password decoders, etc. must be accessible by the broker at runtime.
|
||||||
Package the dependency in a jar, and put it on the broker's classpath.
|
Package the dependency in a jar, and put it on the broker's classpath.
|
||||||
This can be done by placing the jar file in the `lib` directory of the broker distribution itself or in the `lib` directory of the broker instance.
|
This can be done by placing the jar file in the `lib` directory of the broker distribution itself,
|
||||||
|
by placing the jar file in the `lib` directory of the broker instance,
|
||||||
|
by setting the system property `artemis.extra.libs` with the directory that contains the jar file, or
|
||||||
|
by setting the environment variable `ARTEMIS_EXTRA_LIBS` with the directory that contains the jar file,
|
||||||
A broker instance does not have a `lib` directory by default so it may need to be created.
|
A broker instance does not have a `lib` directory by default so it may need to be created.
|
||||||
It should be on the "top" level with the `bin`, `data`, `log`, etc.
|
It should be on the "top" level with the `bin`, `data`, `log`, etc.
|
||||||
directories.
|
directories.
|
||||||
|
The system property `artemis.extra.libs` is a comma separated list of directories that contains jar files, i.e.
|
||||||
|
```
|
||||||
|
-Dartemis.extra.libs=/usr/local/share/java/lib1,/usr/local/share/java/lib2
|
||||||
|
```
|
||||||
|
The environment variable `ARTEMIS_EXTRA_LIBS` is a comma separated list of directories that contains jar files and
|
||||||
|
is ignored if the system property `artemis.extra.libs` is defined, i.e.
|
||||||
|
```
|
||||||
|
export ARTEMIS_EXTRA_LIBS=/usr/local/share/java/lib1,/usr/local/share/java/lib2
|
||||||
|
```
|
||||||
|
|
||||||
=== Library Path
|
=== Library Path
|
||||||
|
|
||||||
|
@ -233,18 +233,31 @@
|
|||||||
<instance>${basedir}/target/derby</instance>
|
<instance>${basedir}/target/derby</instance>
|
||||||
<configuration>${basedir}/target/classes/servers/derby</configuration>
|
<configuration>${basedir}/target/classes/servers/derby</configuration>
|
||||||
<noWeb>true</noWeb>
|
<noWeb>true</noWeb>
|
||||||
<libList>
|
|
||||||
<arg>org.apache.derby:derby:${apache.derby.version}</arg>
|
|
||||||
</libList>
|
|
||||||
<args>
|
<args>
|
||||||
<arg>--jdbc</arg>
|
<arg>--jdbc</arg>
|
||||||
<arg>--global-max-messages</arg>
|
<arg>--global-max-messages</arg>
|
||||||
<arg>100</arg>
|
<arg>100</arg>
|
||||||
<arg>--java-options</arg>
|
<arg>--java-options</arg>
|
||||||
|
<arg>-Dartemis.extra.libs=${basedir}/target/derby/jdbc-jars</arg>
|
||||||
|
<arg>--java-options</arg>
|
||||||
<arg>-ea</arg>
|
<arg>-ea</arg>
|
||||||
</args>
|
</args>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<id>create-derby-jdbc</id>
|
||||||
|
<goals>
|
||||||
|
<goal>dependency-scan</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<libList>
|
||||||
|
<arg>org.apache.derby:derby:${apache.derby.version}</arg>
|
||||||
|
</libList>
|
||||||
|
<targetFolder>${basedir}/target/derby/jdbc-jars</targetFolder>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
|
||||||
<execution>
|
<execution>
|
||||||
<phase>test-compile</phase>
|
<phase>test-compile</phase>
|
||||||
<id>create-mysql</id>
|
<id>create-mysql</id>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user