Unable to run a gradle github workflow - java

I am trying to set up a workflow for my project. I used the standard "Configure with gradle" workflow, and just edited the java version from 11 to 17.
But when I push my code, it throws an error:
this is my workflow so far
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Setup jdk-17
uses: actions/setup-java#main
with:
java-version: 17
distribution: 'adopt'
- name: Build with Gradle
uses: gradle/gradle-build-action#0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: ./gradlew build
Gradle User Home cache not found. Will initialize empty.
Error: Error: Gradle script '/home/runner/work/Slapbot-stewie/Slapbot-stewie/gradlew' is not executable.
I do not know how to fix this error, I found no relevant google search that can help with this.

Arguments is just build since you are using the gradle actions instead of the ./gradlew :
- name: Build with Gradle
uses: gradle/gradle-build-action#0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: build

Related

How to download the latest jar file from GitHub packages and deploy to cloud hub using Maven GitHub actions?

I have created a GitHub package and created releases with GitHub actions for a simple Hello-world mule application.
name: GitHub Packages and Releases using Java CI with Maven
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: 11
- name: Build with Maven
run: mvn -B package --file pom.xml
Publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: '11'
- name: Create GitHub Release
uses: actions/create-release#v1
env:
GITHUB_TOKEN: ${{secrets.GIT_TOKEN}}
with:
tag_name: v${{github.run_number}}
Now I wanted to download the jar file from the GitHub package or extract zip folder (source code.zip) from Releases and deploy the jar file to cloud hub using Maven GitHub actions.
Thanks in Advance
You can't use Mule Maven plugin to publish an existing jar to CloudHub. It only supports publishing what's being built with Maven. You can use instead Anypoint CLI. For example with the command runtime-mgr cloudhub-application deploy you can deploy a jar file to CloudHub.

Github action: setup-java with multiple JDKs and corresponding environment variables

Background:
I've a spring-boot 2.3 project using reactive driver for cassandra that is built on Java 11. For integration test though, when I spin up an embedded Cassandra database, I rely on presence of Java 8 on the machine with accompanying environment variable JAVA8_HOME.
Question:
How can I configure GitHub action setup-java to utilise multiple JDKs for my build and let JAVA_HOME point to Java 11 but JAVA8_HOME point to Java8?
Using multiple JDKs with GitHub actions is already possible today. One great and neat way is to leverage the strategy.matrix job configuration like that in your .github/workflows/maven.yml:
name: github
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 8, 11, 15 ]
steps:
- uses: actions/checkout#v2
- uses: actions/setup-java#v1
with:
java-version: ${{ matrix.java-version }}
- run: mvn -B install --no-transfer-progress --file pom.xml
I didn't check if this does include the environment variable configuration for JAVA_HOME you need - but it clearly isolates the build environments for the separate Java versions. Here's a full example project using this setup: https://github.com/codecentric/cxf-spring-boot-starter and here's a green build log.
Also the GitHub actions GUI for matrix builds is quite nice:
Not exactly setup-java, but you can try another java-install action: https://github.com/AdoptOpenJDK/install-jdk#multiple-jdks. Use target property for setting up env var to use as JAVA_HOME.

Jenkins with mvn missing dir error

I've created jenkins job which need to build something very simple
Clone this repo
https://github.com/g0t4/jenkins2-course-spring-boot
cd to project
https://github.com/g0t4/jenkins2-course-spring-boot/tree/master/spring-boot-samples/spring-boot-sample-atmosphere
and run mvn compile
inside the atmosphere there is a pom.xml file, so what could be the reason to no finding it ?
I've configure the task like following
The error in the log is:
Checking out Revision 4bde91e33e2860b2aab142028c04eff37b7791f2 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 4bde91e33e2860b2aab142028c04eff37b7791f2
Commit message: "Adding in jacoco code coverage"
First time build. Skipping changelog.
[atmo_local] $ mvn -f spring-boot-samples/spring-boot-sample-atmosphere/pom.xml complie
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
update
When I click on my mac mvn -v I get
Apache Maven 3.3.9 (bb52d2b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
update 2 this is the global configuration
I've installed the latest jenkins with maven plugin . this is not sufficient ?
No, it's not. You have to also configure Maven location to jenkins.
The steps are something like:
Click Manage Jenkins
Click Global Tool Configuration
In the JDK section click Add JDK button, uncheck Install automatically checkbox and enter Name and JAVA_HOME values to point to right locations
In the Maven section click Add Maven button, uncheck Install automatically checkbox and enter Name and MAVEN_HOME value (whatever it is in your jenkins system)
Click Apply and then Save

How can I configure my travis.yml for Play framework?

I want to configure my travis.yml for Play framework 2.4.3 Java project, but I couldn't find anything about that.
This is my current .travis.yml:
language: java
sudo: false
addons:
apt:
packages:
- oracle-java8-installer
jdk:
- oraclejdk8
env:
PLAY_VERSION=2.4.3
before_script:
wget http://downloads.typesafe.com/releases/play-${PLAY_VERSION}.zip
unzip -q play-${PLAY_VERSION}.zip
script: play-${PLAY_VERSION}/play deps --sync
notifications:
email: false
As you know, Play framework use Activator since 2.3.8 version, and how can I download play framework 2.4.3 from full URL? Because http://downloads.typesafe.com/releases/play-${PLAY_VERSION}.zip this URL is not working.
My Project Spec:
Play Framework 2.4.3
MySQL 5.7.9
Hazelcast (Maybe could be Redis)
Debian 8 (on cloud)
Travis-CI (Pro)
Github
IntelliJ Idea 14
If your project uses the standard project setup that activator provides, there's very little you need to do to integrate with Travis CI. I am not sure why you are downloading the framework, when sbt should be doing that for you.
All you need is a .travis.yml file at the root of the project with the following content:
For Java:
language: java
jdk:
- oraclejdk8
For Scala:
language: scala
jdk:
- oraclejdk8
Travis will find your projects sbt files and will fetch the Play Dependencies for you. See my scala example here
Perhaps you could try a maven repo:
wget http://central.maven.org/maven2/com/typesafe/play/play-ws_2.10/2.4.3/play-ws_2.10-2.4.3.jar
PS: 'm not familiar with Activator; I looked at your question since it mentions Hazelcast.
this config work for me, my project is play framework with java.
language: scala
sudo: true
scala:
- 2.11.6
jdk:
- oraclejdk8
install: true
Thanks.

Building Apache Roller on Windows 7

I am getting this kind of error when i tried to build apache roller on my windows 7 service pack 1 64 bit.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (gen-db-scripts) on project roller-webapp: An Ant BuildException has occured: Exception thrown by 'generator.parse'. For more information consult the velocity log, or invoke ant with the -debug flag.
[ERROR] around Ant part ...<texen outputFile="README.txt" controlTemplate="control.vm" outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql" contextProperties="F:\roller-trunk\app/src/main/resources/sql/dbscripts.properties"/>... # 5:261 in F:\roller-trunk\app\target\antrun\build-main.xml: F:\roller-trunk\app\target\dbscripts\db2\createdb.sql (The system cannot find the path specified)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (gen-db-scripts) on project roller-webapp: An Ant BuildException has occured: Exception thrown by 'generator.parse'. For more information consult the velocity log, or invoke ant with the -debug flag.
around Ant part ...<texen outputFile="README.txt" controlTemplate="control.vm" outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql" contextProperties="F:\roller-trunk\app/src/main/resources/sql/dbscripts.properties"/>... # 5:261 in F:\roller-trunk\app\target\antrun\build-main.xml
i suspect this outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql"` is the problem but i have no idea how to fix it. I ran the "mvn clean install" from my command prompt.
I succeeded building Roller source code in current SVN trunk (5.2.0-SNAPSHOT) on Windows 7 box without errors. output of mvn -version is following:
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T20:57:37+09:00)
Maven home: c:\apache-maven-3.3.3
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_45\jre
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"
Could you try building with same version of JDK/Maven to the above output?
UPDATE
Now GitHub distribution of Roller can be built without this error. For detail check https://issues.apache.org/jira/browse/ROL-2086
GitHub doesn't store the empty directories that Roller needs to do the build, if this patch were applied (https://github.com/apache/roller/pull/3) the problem would be fixed.
My work-in-progress Github fork of Roller, TightBlog, already has this change in place: https://github.com/gmazza/tightblog. But TightBlog is not ready for regular use.
I believe this error happens because of direct pull from the Github version. At first, I've tried to pull it from Github and I faced the same problem. Later on, I've tried to checkout it directly from the SVN trunk and there's no problem with the building process.
I believe this error has also been described previously at http://comments.gmane.org/gmane.comp.java.roller.devel/5895. It is stated that there might be some problems with the Github version.

Categories

Resources