Bitbucket's pipelines with Java Maven project and JFX

Hi everyone, my team and I have a maven project using jdk1.8 (not open jdk) and javaFX for our UI. It's working well and there still a lot of work to do and we'd like to use the pipelines from Bitbucket to make continuous integration on the go.

I tried to use a simple .yml file :

image: maven:3.3.9-jdk-8
pipelines:
default:
- step:
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B verify # -B batch mode makes Maven less verbose

But there is my problem, We are developping with IntelliJ and jdk1.8 where javaFX is standard and automatically included in the project. But the pipelines tries to use openjdk1.8, and can't find the javaFX classes (especially the jfxrt.jar file).

If I do nothing and try as it is, the Maven error is :

[ERROR] /opt/atlassian/pipelines/agent/build/src/main/java/JFX/MainJFX.java:[3,26] package javafx.application does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/src/main/java/JFX/MainJFX.java:[4,19] package javafx.fxml does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/src/main/java/JFX/MainJFX.java:[5,20] package javafx.scene does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/src/main/java/JFX/MainJFX.java:[6,20] package javafx.scene does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/src/main/java/JFX/MainJFX.java:[7,20] package javafx.stage does not exist

 I tried to include the jfxrt.jar file to maven to my pom.xml as a system dependency like that :

<dependency>
            <groupId>javafx</groupId>
            <artifactId>jfxrt</artifactId>
            <version>${java.version}</version>
            <scope>system</scope>
            <systemPath>${java.home}/lib/ext/jfxrt.jar</systemPath>
</dependency>

But then Maven warns me he does not find the jfxrt.jar file :

[WARNING] 'dependencies.dependency.systemPath' for javafx:jfxrt:jar refers to a non-existing file /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar @ line 34, column 25

Mainly because he is using openjdk and not jdk.

 

I also tried to put the jfxrt.jar file inside the repository and make a dependency to it, it works but Maven warns me it's not proper to do it like that :

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>javafx</artifactId>
            <version>2.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/dependency/jfxrt.jar</systemPath>
        </dependency>

and the warning :

[WARNING] 'dependencies.dependency.systemPath' for com.oracle:javafx:jar should not point at files within the project directory, ${basedir}/dependency/jfxrt.jar will be unresolvable by dependent projects @ line 34, column 25[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

My question is how to either force Maven to use JDK and not OpenJDK (in Bitbucket !), or how to make a nice dependency to javaFX so Maven can verify our project everytime we push and not warn us.

 

Thank you all for your future responses.

1 answer

0 vote

I have the same problem. Any solutions?

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

706 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot