Oxygen plugins - how to include dependent libraries as jars in the install goal, or build?
Posted: Mon Feb 03, 2020 6:19 pm
Hello,
I am using the oxygen-sample-plugin-workspace-access project as a basis for a proof-of-concept. I want to include a jar as a dependency.
I’ve added the jar to the local repository, with the following command:
I can verify the jar, pom and other files are deployed here, in the local repository:
I added the artifact to the project pom file like this:
I’ve added some code to the project, referencing a class in the jar, and it compiles fine – so I know the project is finding the jar.
When I run the maven install goal, it builds successfully. But when I try to use the new code, I get this error:
I can find the project jar deployed to Oxygen here:
C:\<path>\oxygen\plugins\oxygen-sample-plugin-workspace-access-0.0.1\lib\oxygen-sample-plugin-workspace-access-0.0.1.jar
But, I can’t find the LinkFinder.jar file, which contains the class in the error. I need to include the jar as a dependency in the deployment for the code to work. How can I do that?
I was going to try using the <includes><include> tag under <configuration> in the pom.xml file, as documented here:
https://maven.apache.org/plugins/maven- ... clude.html
But, <include> does not appear to be an option in my project.
I was also looking at <includes> under <resources> in the pom.xml file, as covered here:
https://maven.apache.org/plugins/maven- ... clude.html
But jars don’t seem to be something you want to put in the \resources folder.
How do you include jar files as dependencies during the “install” goal in maven? Or, any standard way?
Thank you,
Will
I am using the oxygen-sample-plugin-workspace-access project as a basis for a proof-of-concept. I want to include a jar as a dependency.
I’ve added the jar to the local repository, with the following command:
Code: Select all
>mvn install:install-file -Dfile=C:\<path>\LinkFinder.jar -DgroupId=com.nom.id -DartifactId=linklookup -Dversion=1.0 -Dpackaging=jar
Code: Select all
C:\<path>\.m2\repository\com\nom\id\linklookup\1.0
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>myGroup</groupId>
<artifactId>oxygen-sample-plugins</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>oxygen-sample-plugin-workspace-access</artifactId>
<dependencies>
<dependency>
<groupId>com.nom.id</groupId>
<artifactId>linklookup</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
When I run the maven install goal, it builds successfully. But when I try to use the new code, I get this error:
Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/nom/id/linklookup/LinkLookupQueryFrame
at myGroup.mySample.workspace.CustomWorkspaceAccessPluginExtension.insertLink(CustomWorkspaceAccessPluginExtension.java:373)
C:\<path>\oxygen\plugins\oxygen-sample-plugin-workspace-access-0.0.1\lib\oxygen-sample-plugin-workspace-access-0.0.1.jar
But, I can’t find the LinkFinder.jar file, which contains the class in the error. I need to include the jar as a dependency in the deployment for the code to work. How can I do that?
I was going to try using the <includes><include> tag under <configuration> in the pom.xml file, as documented here:
https://maven.apache.org/plugins/maven- ... clude.html
But, <include> does not appear to be an option in my project.
I was also looking at <includes> under <resources> in the pom.xml file, as covered here:
https://maven.apache.org/plugins/maven- ... clude.html
But jars don’t seem to be something you want to put in the \resources folder.
How do you include jar files as dependencies during the “install” goal in maven? Or, any standard way?
Thank you,
Will