How to include FMPP as a maven dependency not as a plugin - java

I want to write a FMPP Front End application but the official documentation do not explains how to include the FMPP library in a maven project, but the plugin. So i want to know how to include the library so i can extend the fmpp.setting.Settings; object.

I found it in the fmpp-maven-plugin dependencies :), so just include something like this in the dependencies' block in the pom.xml
<dependency>
<groupId>net.sourceforge.fmpp</groupId>
<artifactId>fmpp</artifactId>
<version>0.9.15</version>
</dependency>
Then use Clean and Build and try using in any java file:
import fmpp.setting.Settings;
Thats it!

Related

How to let kotlin library support java project friendly

I create an kotlin library and published into maven central.
However, if this library is used by pure java project, user must add the dependency “kotlin-stdlib” explicitly.
It looks like that the “koitlin-stdlib” is automatically excluded from grade/maven dependency tree because it is treated as provided dependency.
How to resolve this problem?
In gradle you can add
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
The generated pom.xml should contain this dependency.
See:
https://mvnrepository.com/artifact/io.github.ragin-lundf/bdd-cucumber-gherkin-lib/1.48.0
-> under runtime dependencies
https://github.com/Ragin-LundF/bbd-cucumber-gherkin-lib/blob/main/build.gradle
-> as an example how to generate the pom for publishing to maven central in gradle
I find the reason.
implemetation(kotlin("reflect"))
is not OK,
api(kotlin("reflect"))
must be used.

The type javafx.fxml.FXMLLoader is not accessible (vscode)

so i've been working on a Maven Project which supports JavaFX. I tried to use javafx.fxml.FXMLLoader, but i couldn't, since "FXMLLoader cannot be resolved". I tried fixing Maven dependencies (since javafx.fxml didn't showed up) but it just didn't work.
This is my main:
[4: The type javafx.fxml.FXMLLoader is not accessible
20: FXMLLoader cannot be resolved]1
Hope somebody can help me, thanks!
Referenced Libraries is for no build tools project. You use Maven, dependency is the right option instead of jars.
Add the following in pom.xml, then extension will notice you to synchronize configuration.
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>18-ea+8</version>
</dependency>
You can check the existed dependencies from Maven--> Dependencies in the left:

Resolving Dependency from Github using Ivy.xml

I have a github repo that I created a Release for. While creating the release I manually added a .jar file. Lets call it exampleLibrary.jar
This would be github.com/MyExampleRepo/Releases
I have a project I want to add a dependency for to use this exampleLibrary.jar file I added in my release v1.0
This project using Ivy.xml for resolving dependencies.
To get the jar from github using maven with pom.xml I imagine it would look something like this:
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo name</artifactId>
<version>Release tag</version>
</dependency>
How would I do this using Ivy.xml? This is what I have tried:
<dependency org="com.github" name="MyExampleRepo" rev="v1.0"/>

Maven dependency doesn't exist after pom.xml dependency addition in Java?

After I added this dependency to my pom.xml file:
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout-swing</artifactId>
<version>5.0</version>
</dependency>
I tried to import com.miglayout.*; but I got the error:
package com.miglayout does not exist
How come nothing is wrong with other libraries I have imported using Maven in the same project, but I get issues with com.miglayout?
I believe the correct package is net.miginfocom.*
The maven groupId does not always correlate with the package name.
See MigLayout Javadocs
The classes inside the MiG layout library are under the packages:
net.miginfocom.swing for the miglayout-swing artefact
net.miginfocom.layout for the miglayout-core artefact (transitive dependency of miglayout-swing).
If you are using an IDE, you should not write the imports yourself and let the IDE handle it. This way, you will avoid mistakes relating to wrong package imports. Also, you should not use import on-demand and prefer single type import.

Maven: Resolving Duplicate Dependencies

I'm developing an application that will be used internally at our company. In order for it to interop with our other internal systems I have to use some maven dependencies that we use internally, but this is causing some issues with using some external 3rd party dependencies that I also need.
So essentially my pom looks like this:
<dependencies>
<dependency>
internal-framework-artifact
</dependency>
<dependency>
necessary-third-party-artifact
</dependency>
</dependencies>
I've come to find that both of these dependencies have the apache's commons-collections as one of their own dependencies (among a large number of others, but we'll just keep it at one for this question's simplicity).
If I place exclusion rules on both of them for the commons-collections pom I can compile the project, but my resulting jar won't have access to either version of commons-collections and will just result in a java.lang.NoClassDefFoundError exception. Removing the exclusion rule on either of them just results in a mvn compiler error:
[WARNING] Rule 2: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
Duplicate classes found:
I've been looking through various so q/a's and I can't really seem to find something that's 100% relevant to my situation. I'm really at a loss as to how to resolve this. Am I missing something really obvious?
I've never actually used the maven-shade-plugin for shading, but I think this is the exact use case it was designed for.
Create a new project that uses the maven-shade-plugin (see: http://maven.apache.org/plugins/maven-shade-plugin/) to produce an uber-jar version of internal-framework-artifact which contains that classes in internal-framework-artifact and all its dependencies. Configure the plugin so that it relocates all the classes that are also dependencies of necessary-third-party-artifact to some non-conflicting package names. This new project should produce a .jar with a different name, something like internal-framework-artifact-with-dependencies.
Now modify your original pom so that it is dependent on internal-framework-artifact-with-dependencies instead, and it should work.

Categories

Resources