OpenNTF / org.openntf.nsfodp

Maven and Eclipse tooling for working with NSF on-disk-project representations
Apache License 2.0
14 stars 6 forks source link

Add ability to include Maven dependencies inside the compiled NSF #221

Open jesse-gallagher opened 4 years ago

jesse-gallagher commented 4 years ago

This would be a variant of https://github.com/OpenNTF/org.openntf.nsfodp/issues/88 , where it would also copy the JARs in the resultant NSF. This should be a configuration option, similar to maven-bundle-plugin/bnd's Embed-Dependency instruction.

boberhauser commented 3 days ago

Just wanted to share a small workaround, we're using to let Maven handle the required dependencies:

  1. Setup your dependencies in Maven as you normally would.
  2. Setup Maven dependency plugin to copy the dependencies to nsf/Code/Jars where they get picked up by the compile plugin.
  3. Gitignore nsf/Code/Jars.

Example configuration for the dependency plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.8.0</version>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <!-- we need to copy the dependencies BEFORE the generate-resource phase as
                the NSFODP plugin is generating necessary metadata in that step. -->
            <phase>initialize</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.basedir}/nsf/Code/Jars</outputDirectory>
                <includeScope>runtime</includeScope><!-- includes compile and runtime dependencies -->
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
                <excludeTransitive>true</excludeTransitive>
            </configuration>
        </execution>
    </executions>
</plugin>

Works as expected.

Best regards Ben