I’m working on integrating my company’s proprietary Java code into a KNIME node. The code is complex and has many dependencies that span multiple maven repositories, but the developers have simplified everything through a simple maven dependency:
<dependency>
<groupId>net.my.company</groupId>
<artifactId>myartifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Using this dependency, I can easily import everything and build a standalone executable.
The next step is to integrate this functionality into KNIME. I believe (though may be mistaken) that the KNIME SDK does not yet support maven. So these are the steps I’ve taken to get things working and avoid NoClassDefFoundError and ClassNotFoundException. Note that I’ve started with the KNIME Wizard “NumberFormatter”:
Step 1: Convert my KNIME NumberFormatter project to Maven by [Project][Configure][Convert to Maven Project]
Step 2: Edit my pom.xml to include my company’s dependency
Step 3: On the command line, run the following maven command from the directory containing the new pom.xml:
$ mvn dependency:copy-dependencies -DoutputDirectory=lib
This has the effect of copying all of the dependencies into a /lib directory that is local to my KNIME project. As the project is complex, about 50 JAR files get copied across.
Step 4: Open up plugin.xml and manually add all of the dependencies to the [Runtime][Classpath]
Step 5: Check that everything was added to the MANIFEST.MF
While I’m still just building a little proof-of-concept, these steps look like they basically work. My problem is that it all looks very brittle and un-maven-like. If I need to upgrade something then these steps could be very painful to maintain.
Could I be doing this in a better way?