Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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.

3 answers

I have the same problem. Any solutions?

The problem is that the docker image doesn't support JavaFX.

There are two solutions:

1) Find an image with openjfx on hub.docker.com.  This is preferred, since it takes fewer build minutes than the next solution.

2) Install openjfx before building.  At the beginning of your script block, add:

- apt update
- apt install openjfx -y

I've had the same issue: you need to find an image that has javafx libraries

image: hbongen/openjfx-maven:latest

pipelines:
default:
- step:
caches:
- maven
script:
- apt-get update
- apt-get install -y openjfx
- mvn -B verify -P bitbucket_pipeline -Djavafx-location=/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

486 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you