BiRT latest Runtime as one Maven Dependency for Eclipse - birt

I have a given eclipse maven project which builds to a jar. The pom has one major dependency of BiRT 4.8.0-202010080643 Runtime.
<dependency>
<groupId>com.customer.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.8.0-202010080643</version>
</dependency>
So they pushed the artifact into their own nexus; thats why com.customer.birt.runtime.
I really don't know how the guy did that and which tools he used. Currently I want to update to BiRT 4.9. Replacing the above with the only available:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime</artifactId>
<version>4.9.0</version>
<type>pom</type>
</dependency
does not go well. Both are totally different constellations from the same big project. How can I make use of the above maven dependency of 4.9 in my simple birt project? I'm building only a service for a desktop application that is hosted and run within an RCP application. I started to list the individual maven deps so that the java compiles which I succeeded to but I still have few unit tests that execute and render ReportEngine and fail because of missing Deps at runtime. This is because the ReportEngine is loading APIs at runtime..
I started to post here once I noticed that I will be declaring the separate deps in pom.xml blindly which is (even if the Unittests pass) very unreliable..
Thank you so much!
M.Abdu

My solution was currently as I put in the comments or yet simpler. I just uploaded manually the birt-runtime jar into nexus using my account within the customer and then put in my pom the exact same unique coordinates groupid:artifactid:version. Plus some other dependencies depending of what my unit tests are asking at runtime, e.g. eclipse.platform, emf.core, w3c, batik.css etc.
I am talking about executing the build using mvn clean verify and resulting a jar file
The jar you get from here
https://search.maven.org/remotecontent?filepath=org/eclipse/birt/birt-runtime/4.9.0/birt-runtime-4.9.0.zip
pom in my case:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>runtime</artifactId>
<version>4.9.0-20220502</version>
</dependency>

Related

How to incorporate BIRT 4.9.0 into POM?

Scenario:
I am refactoring my application to work under java 17. Birt runtime 3.7.x is embedded in my application.
In updating to point to birt 4.9.0, I have updated my pom as follows:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime</artifactId>
<version>4.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.birt/birt-runtime-osgi -->
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime-osgi</artifactId>
<version>4.9.0</version>
</dependency>
When I build, I get the exception
org.eclipse.birt:birt-runtime:jar:4.9.0 was not found in https://repo1.maven.org/maven2 during a previous attempt
I have deleted and rebuilt my local .m2 directory.
When I dig around the maven repository I find the file at https://repo1.maven.org/maven2/org/eclipse/birt/birt-runtime/4.9.0/
This link (BiRT latest Runtime as one Maven Dependency for Eclipse) was resolved by manually downloading the file and pointing to a local copy. I'd prefer to avoid that, since Maven is all about avoiding that kind of scenario.
I suspect there's something in the maven path I am missing.
Thank you in advance.

FlinkMLTools NoClassDef when running jar built with maven

I'm working on a recommender system using Apache Flink. The implementation is running when I test it in IntelliJ, but I would like now to go on a cluster. I also built a jar file and tested it locally to see if all was working but I encountered a problem.
java.lang.NoClassDefFoundError: org/apache/flink/ml/common/FlinkMLTools$
As we can see, the class FlinkMLTools used in my code isn't found during the running of the jar.
I built this jar with Maven 3.3.3 with mvn clean install and I'm using the version 0.9.0 of Flink.
First Trail
The fact is that my global project contains other projects (and this recommender is one of the sub-project). In that way, I have to launch the mvn clean install in the folder of the right project, otherwise Maven always builds a jar of an other project (and I don't understand why). So I'm wondering if there could be a way to say explicitly to maven to build one specific project of the global project. Indeed, perhaps the path to FlinkMLTools is contained in a link present in the pom.xml file of the global project.
Any other ideas?
The problem is that Flink's binary distribution does not contain the libraries (flink-ml, gelly, etc.). This means that you either have to ship the library jar files with your job jar or that you have to copy them manually to your cluster. I strongly recommend the first option.
Building a fat-jar to include library jars
The easiest way to build a fat jar which does not contain unnecessary jars is to use Flink's quickstart archetype to set up the project's pom.
mvn archetype:generate -DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-scala -DarchetypeVersion=0.9.0
will create the structure for a Flink project using the Scala API. The generated pom file will have the following dependencies.
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-scala</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-scala</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients</artifactId>
<version>0.9.0</version>
</dependency>
</dependencies>
You can remove flink-streaming-scala and instead you insert the following dependency tag in order to include Flink's machine learning library.
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-ml</artifactId>
<version>0.9.0</version>
</dependency>
When you know build the job jar with mvn package, the generated jar should contain the flink-ml jar and all of its transitive dependencies.
Copying the library jars manually to the cluster
Flink includes all jars which are located in the <FLINK_ROOT_DIR>/lib folder in the classpath of the executed jobs. Thus, in order to use Flink's machine learning library you have to put the flink-ml jar and all needed transitive dependencies into the /lib folder. This is rather tricky, since you have to figure out which transitive dependencies are actually needed by your algorithm and, consequently, you will often end up copying all transitive dependencies.
How to build a specific sub-module with maven
In order to build a specific sub-module X from your parent project you can use the following command:
mvn clean package -pl X -am
-pl allows you to specify which sub-modules you want to build and -am tells maven to also build other required sub-modules. It is also described here.
In cluster mode, Flink does not put all library JAR files into the classpath of its workers. When executing the program locally in IntelliJ all required dependencies are in the classpath, but not when executing on a cluster.
You have two options:
copy the FlinkML Jar file into the lib folder of all Flink TaskManager
Build a fat Jar file for you application that includes the FLinkML dependencies.
See the Cluster Execution Documentation for details.

How to modify Cucumber-jvm

I am running cucumber-jvm via JUnit and maven. I can get into the source code and make changes to the core code, but these changed do not affect the other projects that run cucumber-jvm.
How do I make changes to the core and have the other projects on my machine be affected? Does maven only run the jars on github? Do I have to create a new cucumber-jvm project and add that project as a dependency instead of:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
Thanks.
You've pulled down the Cucumber-JVM code and modified it locally, yes? Then all you need to do is run a Maven build (not within Eclipse!). This will replace the downloaded dependencies in your Maven repo with newer ones you've changed (but only the ones you've changed). Then your tests should pick up your changes.
If you want to commit your changes back to Cucumber-JVM as enhancements or bug-fixes, and you should, if you feel they'll be useful, you'll need to go through the github pull request process - see the Cucumber-JVM website for details on that.
As #TrueDub said, you need to clone the project locally, and build it using mvn install. This will build the project and install it in your local repository. Any project you build locally referencing the version of cucumber-jvm you have built in their pom will be using your modified version.
If you need to distribute your version of cucumber-jvm to other environment, the best bet is to use a Nexus repository to deploy your artefact and make it available for others to use within your organization. Make sure you give that artefact a name (or classifier, or version) that distinguishes your version from the official one to avoid potential confusion – in which case poms using your version of cucumber-jvm must be modified to use that particular version.

How to include jar in Maven Netbeans proj that doesnt exist in maven repo

I am using Netbeans to build a Maven project, and have the JTidy java library as a dependency. It turns out JTidy doesnt exist in any maven repos, so I can't just add a "normal" depedency entry for it.
What is the best way of handling dependencies to libraries in Maven projects that arent available on repos?
I've currently tried adding it to my maven pom as such (after copying the jar to my projects /libs folder)
<dependency>
<groupId>org.w3c</groupId>
<artifactId>org.w3c.tidy</artifactId>
<version>9.3.8</version>
<scope>system</scope>
<systemPath>${basedir}/libs/jtidy-r938.jar</systemPath>
</dependency>
However it complains that it will be unresolvable by dependent projects.
First of all, it's under another groupId, that's why you didn't find it.
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
</dependency>
Jtidy
But to answer your question, one way of doing this is to manually install it in your local repo as described here.
The best way IMHO is to add it to a proxy like Nexus. That way other people can access it from there without having to install it locally. However, this means you have to set up a repository manager, which doesn't make much sense if you are the only developer on the project.

How can I add a JavaFX 2.0 class to an existing Maven project?

I have a Maven project that just displays a graph on the xy axis. I want to change that graph to a Javafx 2.0 linechart to display the same data. I tried using the FEST-javafx-maven plugin, but I still cannot compile the code; the compiler cannot find all of the javafx.xxx imports.
Any help would be appreciated.
Update (Oct 6 2015)
Modern JavaFX versions (shipped with Oracle Java 8+) do not require any additional class path to use JavaFX. The JavaFX runtime is on the default classpath Java uses for compilation and execution. This means that a plain maven pom.xml file, with no additional dependencies, will build a JavaFX application.
However, if you wish to use additional packaging features for your application, such as the ability to deploy it as a self-contained application, then I advise using the (third party) JavaFX Maven plugin.
Previous Answer
The following information in this answer is now mostly old and outdated.
The link to the fest maven plugin I found (http://fest.easytesting.org/javafx/maven/) is to a tool for building JavaFX 1.x script projects, which is a completely different and incompatible beast to JavaFX 2.0 - I'm not sure if there is an updated version of the fest maven plugin which supports JavaFX 2.0.
There is currently no official support for Maven from Oracle, nor a version of JavaFX 2.0 in a publicly hosted Maven repository.
However, I have successfully built JavaFX 2.0 projects using maven in the past by using a system scoped dependency on the jfxrt.jar and (optionally) invoking the JavaFX ant tasks from maven.
If you are embedding your graph in an existing Swing application via a JFXPanel, then you don't need to use the JavaFX ant tasks. Add jfxrt.jar from the JavaFX runtime as a system dependency OR manually install it into your maven repository to use a non-system scoped dependency.
An example of the command to manually install the required JavaFX 2.0 runtime jar is:
mvn install:install-file -Dfile="C:\Program Files\Oracle\JavaFX 2.1.0 SDK\rt\lib\jfxrt.jar" -DgroupId=com.oracle.javafx -DartifactId=javafx -Dversion=2.1 -Dpackaging=jar
After running the above command, add the dependency to the jfxrt.jar file to your maven pom and your project compilation should resolve all JavaFX API references:
<dependency>
<groupId>com.oracle.javafx</groupId>
<artifactId>javafx</artifactId>
<version>2.1</version>
</dependency>
If you extend the JavaFX Application class and you want your application packaged for deployment via webstart, browser embedding or as a JavaFX installation aware clickable jar, then you should adapt your pom.xml file to execute the relevant JavaFX 2.0 ant tasks - http://code.google.com/p/willow-browser/source/browse/pom.xml demonstrates such an adaption.
These threads discuss JavaFX 2.0 maven support and provide further background info and samples:
https://forums.oracle.com/forums/thread.jspa?messageID=9970002
http://mail.openjdk.java.net/pipermail/openjfx-dev/2011-December/000076.html
I had the same problem and here is my solution:
If using Java 7u7 (javafx is integrated into jdk/jre):
<dependency>
<groupId>javafx</groupId>
<artifactId>javafx</artifactId>
<version>2.1</version>
<scope>system</scope>
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
</dependency>
For previous versions of java:
<dependency>
<groupId>javafx</groupId>
<artifactId>javafx</artifactId>
<version>2.1</version>
<scope>system</scope>
<systemPath>${env.JAVAFX_HOME}\rt\lib\jfxrt.jar</systemPath>
</dependency>
And you have to set system variable JAVAFX_HOME to home dir of JavaFx.
You might try the JavaFX Maven plugin. This takes care of adding javafx to the classpath as well as building JavaFX apps and creating Windows/Mac/Linux executables, as well as double-clickable JARs and JNLP files.
Using JDK 1.7 you have to perform the following mvn goal.
mvn com.zenjava:javafx-maven-plugin:2.0:fix-classpath
This command will change the classpath of your JRE and copy the jfxrt.jar to the JAVA_HOME\lib\ext directory.
Take an additional look here for further information:
JavaFX Maven Plugin
Within your pom-file you have to add the following dependency configuration.
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>2.2</version>
<!-- <version>${javafx.min.version}</version> -->
<scope>system</scope>
<systemPath>${java.home}/lib/ext/jfxrt.jar</systemPath>
</dependency>

Resources