maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From org.apache.maven.u...@io7m.com
Subject Distinguishing between host and container dependencies
Date Sat, 03 Sep 2016 13:30:19 GMT
Hello.

I'm working on an application that uses an embedded OSGi container to
provide a plugin system.

The problem I'm running into is that I don't seem to have any way to
distinguish between dependencies that are dependencies of the host, and
dependencies that will only be present in the container. The distinction
is that the former will be copied into a directory to be placed onto the
classpath when the application is started and the latter will not be on
the classpath but will instead be copied into a directory at build time
to be scanned/installed by the container at runtime.

I feel like the most natural way to specify this would be to be able to
add a custom scope:

  <dependency>
    <groupId>x.y.z</groupId>
    <artifactId>example</artifactId>
    <version>0.1.0</version>
    <scope>container</scope>
  </dependency>

The maven-dependency-plugin could then be instructed to copy host
dependencies to one location, and container dependencies to another.
This would also play nicely with IDEs that build classpaths from Maven
dependencies (container-scoped dependencies wouldn't be on the
classpath).

Ideally, this container scope would be propagated transitively
(although I'm not sure what happens if both the host and container
indirectly depend on the same dependency).

I can't distinguish based on types alone, as all of the dependencies
are a mix of plain jars and OSGi bundles (some host dependencies are
bundles, some are plain jars, all of the container dependencies are
bundles).

Is there some other way I can achieve this? Alternatives that don't
play nicely with IDEs aren't an option.

M

Mime
View raw message