I'm trying to build my own liferay portlet using blade cli but failed. I have 2 failed error
First error is after I init blade to create a workspace then go to the directory then i create new module using command
blade create -t mvc-portlet -p com.liferay.docs.guestbook -c GuestbookPortlet my-guestbook-project
then i build the portlet using command inside workspace directory
blade deploy
then give error "zip END header not found"
Error before change gradle version
after that i do some research and i do upgrade the gradle from
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
then i redeploy it and give error
Error after change gradle version
I have been trying to get more into the methodology of continuous integration as of recent, and have chosen Travis CI for the job. However, on one of my projects that uses Java and Kotlin my local builds pass, but fail on Travis.
I've been unable to make sense of the error messages that I am getting as to why my build is failing. kotlin-maven-plugin seems to be the origin of the errors. The problematic command as seen in the build logs is mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V.
I have run this command locally with no errors and a successful build.
Here's a relevant snippet of the stack trace from the CI Build Job:
[INFO] --- kotlin-maven-plugin:1.4.32:compile (compile) # BytesToJava ---
[ERROR] java.lang.ExceptionInInitializerError
at com.intellij.pom.java.LanguageLevel.<clinit>(LanguageLevel.java:25)
at com.intellij.core.CoreLanguageLevelProjectExtension.<init>(CoreLanguageLevelProjectExtension.java:26)
at com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:42)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.<init>(KotlinCoreProjectEnvironment.kt:26)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.<init>(KotlinCoreEnvironment.kt:121)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:425)
Would appreciate some resources or even a relevant issue thread. Thanks in advance :)
Travis Build Logs
The problem was being caused by an issue with illegal reflective operations and the Kotlin Maven Plugin with any project over Java 9 (my project uses Java 15). As described by this thread on YouTrack, a workaround is to:
A workaround is to run mvn with the following environment variable: MAVEN_OPTS=--illegal-access=permit
Adding a global environment variable with the same value to my .travis.yml fixed the issue.
I have a springboot rest server that I can build with ./gradlew build -x test works fine locally. When I push my master branch to Heroku it fails with the below stack trace.
-----> Gradle app detected
-----> Spring Boot detected
-----> Installing JDK 1.8... done
-----> Building Gradle app...
-----> executing ./gradlew build -x test
Downloading https://services.gradle.org/distributions/gradle-4.10.2-bin.zip
..........................................................................
> Task :compileJava
/tmp/build_20fcdda80fef571f4d65e4396cb813c1/src/main/java/com/edge/riskassesmentwebapp/dto/OnsiteAbandonmentDto.java:10: error: class OnSiteAbandonmentDto is public, should be declared in a file named OnSiteAbandonmentDto.java
... (it repeats the above error for a bunch of classes)
This is my first time deploying a springboot application to Heroku and I'm not sure how to fix the build if it works locally.
try to rename the file OnsiteAbandonmentDto to OnSiteAbandonmentDto.
Note the difference in capitalization
While developing an app I came into following error. I tried downgrading the java version from 11 to 8, but that wasn't helpful.
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
How I solved this problem:
First, make sure that I have %java_home% variable set and also %path% has the java sdk included.
How to setup Java environment variables
Second, Go to your android folder and run this command:
C:\Projects\myproject\android>gradlew.bat app:installDebug.
Unzipping
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip
to
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Exception in thread "main" java.util.zip.ZipException: error in
opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:225)
at java.util.zip.ZipFile.(ZipFile.java:155)
at java.util.zip.ZipFile.(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:215)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:75)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
As you can see that my gradle download is corrupt. All you have to do is delete this folder and rerun the command.
C:\Projects\myproject\android>gradlew.bat app:installDebug
Downloading
https://services.gradle.org/distributions/gradle-4.10.2-all.zip
...............................................................................................................
Unzipping
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip
to
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Welcome to Gradle 4.10.2!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC6
- Nested included builds
- SNAPSHOT plugin versions in the plugins {} block
For more details see https://docs.gradle.org/4.10.2/release-notes.html
Now, you can go back to your react native project and run
react-native run-android
info JS server already running. info Building and installing the app
on the device (cd android && gradlew.bat app:installDebug)...
Task :app:installDebug 01:03:18 V/ddms: execute: running am get-config 01:03:18 V/ddms: execute 'am get-config' on 'emulator-5554'
: EOF hit. Read: -1 01:03:18 V/ddms: execute: returning Installing APK
'app-debug.apk' on 'Pixel_2_API_28(AVD) - 9' for app:debug 01:03:18
D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
01:03:18 D/Device: Uploading file onto device 'emulator-5554' 01:03:18
D/ddms: Reading file permision of
C:\Projects\xx\android\app\build\outputs\apk\debug\app-debug.apk
as: rwx------ 01:03:18 V/ddms: execute: running pm install -r -t
"/data/local/tmp/app-debug.apk" 01:03:19 V/ddms: execute 'pm install
-r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1 01:03:19 V/ddms: execute: returning 01:03:19 V/ddms: execute:
running rm "/data/local/tmp/app-debug.apk" 01:03:19 V/ddms: execute
'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit.
Read: -1 01:03:19 V/ddms: execute: returning Installed on 1 device.
BUILD SUCCESSFUL in 9s 27 actionable tasks: 1 executed, 26 up-to-date
info Running
C:\Users\codeb\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 reverse tcp:8081 tcp:8081 info Starting the app on
emulator-5554
(C:\Users\codeb\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 shell am start -n
com.myproject/com.myproject.MainActivity)... Starting:
Intent { cmp=com.myproject/.MainActivity }
Try running this command inside your project file
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
after that
cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
always gradlew clean before run react-native-run-android
the above command basically cleans up the gradle and previous builds.
for ENOENT Error
Check if $ yarn start works. The metro bundler wasn't able to run on port 8081 for me and I needed to run $ killall node
EDIT:
Also update the gradle-wrapper.properties
add
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
remove following code from build.gradle:
task wrapper(type: Wrapper) {
gradleVersion = '5.2.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
after that
cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
always gradlew clean before run react-native-run-android the above command basically cleans up the gradle and previous builds.
You're good to go!
Just run sudo react-native run-android and it will build and install ./gradlew app:installDebug inside android directory for you.
I had this issue too and I was able to fix it by creating a new project in react-native 0.57.3 using the command:
react-native init --version="0.57.3" MyNewApp
You have to update the gradle-wrapper.properties file to use the newest version of gradle:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
And remove this block from build.gradle file:
task wrapper(type: Wrapper) {
gradleVersion = '5.2.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
Then run a gradlew clean on the android folder and everything should work.
I had this issue too and I was able to fix it by run ./gradlew app:installDebug in android folder .
In my case, I uninstalled my java jdk17 and installed java jdk11. It worked for me few seconds ago. Really happy :)))
I had this issue myself, it eventually went away after I uninstalled and re-installed android studio and gradle, but a few other things you could try first
1: Setting GRADLE_USER_HOME in environment variables (if on windows)
2: Downgrade to react-native 0.57.0
3: Make sure you have the correct permissions to run the command and access files
4: Make sure your gradle files are synced correctly, and that location of gradle and the android skd are correct within project structure offline mode
5: Check gradle for updates
(Assuming you are using android studio)
Good luck
The problem is on file:
nameyourapp/android/local.properties
you have to substitute with the correct path: /Users/nameUser/AppData/Local/Android/sdk
I have the same error I just uninstall the JDK old version and install the latest version from https://www.oracle.com/java/technologies/javase-downloads.html and now it's working.
Open your settings.grandler file in the android folder
Change the \ to /
Save the file
Run the command react-native run-android
Trying to deploy a Java app to Google Appengine Managed VM. I'm using console gcloud and already prepared WAR file. Plus app.yaml.
Using following command:
gcloud preview app deploy ./build/libs/app.yaml
Right now it fails with:
Building and pushing image for module [default]
-------------------------------------------------------------------------------- DOCKER BUILD OUTPUT --------------------------------------------------------------------------------
Step 0 : FROM gcr.io/google_appengine/jetty9
---> 005014071b64
Step 1 : ADD webapp-webapp.war $JETTY_BASE/webapps/root.war
---> 3e9023930cc8
Removing intermediate container 342e8a2f5750
Successfully built 3e9023930cc8
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Beginning teardown of remote build environment (this may take a few seconds).
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment.
I see similar error (there) for maven-gcloud-plugin that happens when project is not configured as WAR. But notice that:
i'm using plain command line tool gcloud, a latest version
and my project is packaged into WAR already
Also i'm using following app.yaml (which i've got from maven plugin sources):
runtime: java
env: 2
api_version: 1
handlers:
- url: .*
script: dynamic
So the question, where from this error is coming from (docker image is already prepared at this moment, right?). What it means? And how to fix this?
Update
I noticed that it uses FROM gcr.io/google_appengine/jetty9 for VM. But for Appengine it should be FROM gcr.io/google_appengine/jetty9-compat. I've tried to switch to exploded app instead of WAR, and it started using correct Docker base image. But still fails:
Building and pushing image for module [default]
-------------------------------------------------------------------------------- DOCKER BUILD OUTPUT --------------------------------------------------------------------------------
Step 0 : FROM gcr.io/google_appengine/jetty9-compat
---> 2ad8572ef3d8
Step 1 : ADD . /app/
---> b10f4bc6718e
Removing intermediate container 8b149f4baf9c
Successfully built b10f4bc6718e
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Beginning teardown of remote build environment (this may take a few seconds).
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment.
The reason was this line in app.yaml:
env: 2
it was too simple and too obvious to try to deploy w/o this option. Also, every doc, official and unofficial, mentions that you need to have env: 2 option set to deploy your app as Appengine app. That's really strange.
Removing this line also changed base Docker image to gcr.io/google_appengine/java-compat. I guess it means that jetty images, including jetty9-compat, aren't compatible with Appengine apps