chrisdchristo / capsule-maven-plugin

Capsule Maven Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include plugin dependencies when building capsule

draenor opened this issue · comments

Type: Feature request

What:

Add an option to include dependencies declared to the capsule plugin into the built capsule.

How:

By including declared plugin dependencies, here jetty-runner. There could optionally be a configuration switch to toggle this behavour includePluginDependencies.

<plugin>
  <groupId>com.github.chrisdchristo</groupId>
  <artifactId>capsule-maven-plugin</artifactId>
  <version>1.4.3</version>
  <configuration>
    <appClass>Main</appClass>
    <type>fat</type>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-runner</artifactId>
      <version>${jetty.version}</version>
    </dependency>
  </dependencies>
</plugin>

Why:

The use case it to build a regular war artifact and use capsule to separately build a runnable jar project. This can be achieved quite easily by introducing e.g., a jetty dependency and let the Main class bootstrap it.

Simply marking the jetty depdency as <scope>provided</scope> and set <includeProvidedDep>true</includeProvidedDep> is a poor solution since there may be other provided dependencies.

Comment:

Another approach is to permit downloading dependencies using the dependencySets as such:

 <plugin>
    <groupId>com.github.chrisdchristo</groupId>
    <artifactId>capsule-maven-plugin</artifactId>
    <version>1.4.3</version>
    <configuration>
        <appClass>Main</appClass>
        <type>fat</type>
        <dependencySets>
            <dependencySet>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-runner</artifactId>
                <version>9.4.0.v20161208</version>
            </dependencySet>
        </dependencySets>
    </configuration>
</plugin>

Done in 1.5.0. Please see readme for more info.