Bitbucket Pipelines - mvn clean install not working with JavaFX - docker

I am using Bitbucket Pipelines for building a project from our university.
Here is my configuration from bitbucket-pipelines.yml:
image: maven:3.3.9-jdk-8
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- mvn -f EasyDiet_JavaFX_View/pom.xml clean install
And here is some of the compilation error -> relates to JavaFX:
ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[11,19] package javafx.fxml does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[12,28] package javafx.scene.control does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[13,27] package javafx.scene.layout does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[14,27] package javafx.scene.layout does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[15,20] package javafx.stage does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[27,13] cannot find symbol
symbol: class VBox
location: class at.fhv.easyDiet.teamC.presentation.patientFile.PatientFileController
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[29,13] cannot find symbol
symbol: class BorderPane
location: class at.fhv.easyDiet.teamC.presentation.patientFile.PatientFileController
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[336,12] cannot find symbol
symbol: class Stage
location: class at.fhv.easyDiet.teamC.presentation.patientFile.PatientFileController
And here some output of the build failure:
INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.828 s
[INFO] Finished at: 2016-10-19T10:18:57+00:00
[INFO] Final Memory: 19M/282M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project easydiet-view: Compilation failure: Compilation failure:
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[11,19] package javafx.fxml does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[12,28] package javafx.scene.control does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[13,27] package javafx.scene.layout does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[14,27] package javafx.scene.layout does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[15,20] package javafx.stage does not exist
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[27,13] cannot find symbol
[ERROR] symbol: class VBox
[ERROR] location: class at.fhv.easyDiet.teamC.presentation.patientFile.PatientFileController
[ERROR] /opt/atlassian/pipelines/agent/build/EasyDiet_JavaFX_View/src/at/fhv/easyDiet/teamC/presentation/patientFile/PatientFileController.java:[29,13] cannot find symbol
[ERROR] symbol: class BorderPane
[ERROR] location: class at.fhv.easyDiet.teamC.presentation.patientFile.PatientFileController
If i build it locally on my Mac it works fine, but if i try with Bitbucket Pipelines i only get those errors. I have already tried with the default maven:3.3.3 image.
How is it possible to build JavaFX in Bitbucket Pipelines?

This worked for me:
image: maven:3-jdk-8
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- apt-get update
- apt-get install -y openjfx
- mvn clean install

Related

Syndesis build error: Cannot access cluster for detecting mode

When trying to build syndesis I got this error that prevents me to build the images:
[INFO] --- fabric8-maven-plugin:3.5.38:build (build) # meta ---
[INFO] F8: Using OpenShift build with strategy S2I
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image fabric8/s2i-java:2.1 as base / builder
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[ERROR] F8: Failed to execute the build [io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to
io.fabric8.openshift.client.OpenShiftClient]
...
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.38:build (build) on project meta: Failed to execute the build: io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient -> [Help 1]
...
Command used to build syndesis: syndesis build -i -f --clean-cache -c
This is because you are logged out from the "oc" command. If you try to use it you will get errors like this one:
$ oc get pods
error: the server doesn't have a resource type "pods"
To fix it, you have to login again:
$ oc login
Authentication required for https://192.168.42.178:8443 (openshift)
Username: developer
Password:
Login successful.
You have access to the following projects and can switch between them with 'oc project <projectname>':
myproject
* syndesis
Using project "syndesis".
If command "oc" is not recognized, you have to setup the environment first:
$ eval $(minishift oc-env)

Apache Isis Build Fail specifies unknown repository when use User from ApplicationUser as property of my Entity

I want my Employee has User as bellow
import org.isisaddons.module.security.dom.role.ApplicationRole;
import org.isisaddons.module.security.dom.user.ApplicationUser;
import org.isisaddons.module.security.dom.user.ApplicationUserRepository;
#Column(allowsNull = "true")
#Property(editing = Editing.ENABLED)
#Getter #Setter
private ApplicationUser user;
public List<ApplicationUser> choicesUser() {
return applicationUserRepository.allUsers();
}
public List<ApplicationRole> getUserRoles() {
return user!=null? Lists.newArrayList(user.getRoles()):Lists.newArrayList();
}
#Action()
public Employee createUser(
#ParameterLayout(named = "Username") final String username,
#ParameterLayout(named = "Password") final Password password,
#ParameterLayout(named = "Repeat Password") final Password repeatPassword,
final ApplicationRole initialRole,
final Boolean enable,
final String emailAddress) {
ApplicationUser applicationUser = applicationUserRepository.newLocalUser(username, password, repeatPassword, initialRole, enable, emailAddress);
this.setUser(applicationUser);
return this;
}
When I run on IDE it run fine and everything work as expected, but then I run mvn clean install, it errors as bellow, when I remove code above it build just fine. Are there anything else that I have missed?
[INFO] calling #PostConstruct on all domain services
[WARNING] NOT configured
[ERROR]
[ERROR]
[ERROR]
[ERROR] #DomainObject annotation on org.isisaddons.module.security.dom.role.ApplicationRole specifies unknown repository 'org.isisaddons.module.security.dom.role.ApplicationRoleRepository'
[ERROR] #DomainObject annotation on org.isisaddons.module.security.dom.user.ApplicationUser specifies unknown repository 'org.isisaddons.module.security.dom.user.ApplicationUserRepository'
[ERROR]
[ERROR]
[ERROR]
[INFO] calling #PreDestroy on all domain services
[INFO] shutting down org.apache.isis.core.metamodel.specloader.SpecificationLoader#1f041bad
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Incode QuickStart .................................. SUCCESS [ 0.279 s]
[INFO] Incode QuickStart Base Module ...................... SUCCESS [ 2.480 s]
[INFO] Employment Module .................................. FAILURE [ 11.695 s]
[INFO] Incode QuickStart App Definition ................... SKIPPED
[INFO] Incode QuickStart Webapp ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.022 s
[INFO] Finished at: 2017-11-06T11:09:35+07:00
[INFO] Final Memory: 59M/457M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.isis.tool:isis-maven-plugin:1.15.1:validate (default) on project pApp-module-employment: 2 meta-model problems found. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :pApp-module-employment
Please Help, I also remove ! on pom on swagger by follow another question with similar issue, but it doesn't work !!!
The simpleapp archetype is preconfigured to run the "validate" goal of the Apache Isis maven plugin, which checks for semantic errors (eg orphaned supporting methods) in your domain logic. Your stack shows another one of the errors: an entity referencing a non-existing repository.
The maven plugin runs from an AppManifest - details in the pom.xml of the module-simple module - but this isn't the same AppManifest as is used to bootstrap the application: it is just for a single module.
Since your Employee entity is referencing ApplicationUser, that is resulting in the ApplicationUser being part of the metamodel, and therefore being validated.
My guess is that the AppManifest being used by maven plugin does not reference the Security module (that has the required repositories), and this is triggering the error.
The fix is just to add the declarations for the security module into this AppManifest. You can probably just copy the relevant lines from the AppManifest that you use to bootstrap the app.
HTH

Error while displaying javadocs in Jenkins

I am trying Jenkins with the help of the book - "Jenkins - The Definitive Guide"
I am getting error while displaying javadocs:
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.5.2 or
one of its dependencies could not be resolved: Cannot access central
(https://repo.maven.apache.org/maven2) in offline mode and the
artifact org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 has
not been downloaded from it before. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with
the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException Build step 'Invoke top-level Maven targets' marked build as failure
Both Java and Maven are installed on the machine where Jenkins is running.
I have the following info from the command line
$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-32-generic", arch: "amd64", family: "unix"
Any hint to get around this issue?
--------------------- EDIT ---------------------------
After the last comment I made the changes as suggested and now I got the following errors:
[ERROR] Failed to execute goal on project gameoflife-web: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-
web:war:1.0-SNAPSHOT: Could not find artifact
com.wakaleo.gameoflife:gameoflife-core:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :gameoflife-web
Build step 'Invoke top-level Maven targets' marked build as failure
Recording test results
Publishing Javadoc
Finished: FAILURE

Usergrid Build Error

while I'm trying to build Usergrid, I'm coming across the following error.
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.752 s
[INFO] Finished at: 2015-12-16T01:02:23+03:30
[INFO] Final Memory: 20M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project usergrid-rest: Could not resolve depen
dencies for project org.apache.usergrid:usergrid-rest:war:2.1.1-SNAPSHOT: Failur
e to find org.apache.usergrid:usergrid-java-client:jar:0.0.10-SNAPSHOT in file:/
/C:\usergrid-master\stack\rest/../m2/repository was cached in the local reposito
ry, resolution will not be reattempted until the update interval of local-depend
encies has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
C:\usergrid-master\stack>mvn clean install -rf :usergrid-rest
Any solution ?!?
You need to build sdks/java first in order to build the stack.
cd C:\usergrid\sdks\java
mvn install
cd ..\..\stack
mvn install -DskipTests=true

Why mvn archetype does not work for me?

I'm new on Maven and there's something wrong when I try to create a now project.
E:\java\MavenTest>mvn archetype:generate -DgroupId=com.mycompany.app -DartifacId
=my_app -DarchetypeArtifacId = maven_archetype_quickstart -DinteractiveMode=fals
e
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.108s
[INFO] Finished at: Wed May 15 23:55:57 CST 2013
[INFO] Final Memory: 7M/76M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (E:\java\MavenTest). Please verify you invoked Maven from the
correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception
The pom.xml should be generated automatically. But it does not work.
Any help will be highly appreciated.
The root cause are as the following: -
There is a space at -DarchetypeArtifacId = maven_archetype_quickstart
The archetypeArtifacId should be maven-archetype-quickstart
The -DarchetypeArtifacId is miss spelling, the correct is -DarchetypeArtifactId
Then please try the following: -
mvn archetype:generate
-DgroupId=com.mycompany.app
-DartifactId=my_app
-DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifacId=maven-archetype-quickstart
-DarchetypeVersion=1.1
-DinteractiveMode=false
Please type above command in the single line.
I hope this may help.
Another answer will be related to the console that you are using to generate the maven project with the archetype:
For example:
With Powershell, the command of the answer doesn't work but with this command is working properly
mvn archetype:generate
"-DgroupId=com.mycompany.app
-DartifactId=my_app
-DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifacId=maven-archetype-quickstart
-DarchetypeVersion=1.1
-DinteractiveMode=false"
because of the problems passing the arguments to the maven command.
This is gonna help somebody, it works for me!

Resources