Failed to copy /home/[...]/ecj.jar to /usr/share/ant/lib/ecj.jar due to java.io.FileNotFoundException /usr/share/ant/lib/ecj.jar (Permission denied) - ant

While ant clean works fine within Liferay IDE, when trying from command line I get:
$ ant clean
Buildfile: /home/nico/myportlet/build.xml
[copy] Copying 1 file to /usr/share/ant/lib
Attempt to copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar to /usr/share/ant/lib/ecj.jar using NIO Channels failed due to '/usr/share/ant/lib/ecj.jar (Permission denied)'. Falling back to streams.
BUILD FAILED
/home/nico/myportlet/build.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/portlets/build-common-portlet.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common-plugin.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common.xml:94: Failed to copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar to /usr/share/ant/lib/ecj.jar due to java.io.FileNotFoundException /usr/share/ant/lib/ecj.jar (Permission denied)
Total time: 2 seconds
How to fix that?

Just copy the file manually as root.
After you have done that, ant will be happy and execute the tasks without complaining.
Here is how to do on Linux/Mac:
sudo cp /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar /usr/share/ant/lib/

Or to not messing up with system libraries we could reference folder to ant like :
ant clean -lib /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib

Related

Issues with running remix Binary in Bazel sandbox

I've encountered an issue trying to use bazel as a build tool for remix. I've been able to run remix in dev mode but currently unable to get remix build to work.
I've encountered a few errors that led up to this point. I'll list the errors in the order which they occurred with my fixes (just incase any of the fixes introduces a new issue)
First error in the bazel sandbox is related to a transitive dependency of #remix-run/dev (#remix-run/dev->gunzip-maybe->browserify-zlib). Bazel failed to fetch the bazel repository #npm__browserify-zlib__0.1.4. I assumed this was a bazel issue and tried to override browserify-zlib#0.1.4 with browserify-zlib#0.2.0, which worked. Here is bazel error for reference:
ERROR: /Users/emmanuel/projects/bbbazel/WORKSPACE:89:17: fetching _npm_import rule //external:npm__browserify-zlib__0.1.4: Traceback (most recent call last):
File "/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/external/aspect_rules_js/npm/private/npm_import.bzl", line 471, column 27, in _impl
pkg_json = json.decode(rctx.read(pkg_json_path))
Error in decode: at offset 685, object has duplicate key: "main"
ERROR: /private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/external/npm/BUILD.bazel:3012:6: #npm//:npm__browserify-zlib__0.1.4_source_directory depends on #npm__browserify-zlib__0.1.4//:source_directory in repository #npm__browserify-zlib__0.1.4 which failed to fetch. no such package '#npm__browserify-zlib__0.1.4//': at offset 685, object has duplicate key: "main"
Next error in the bazel sandbox is related to another transitive dependency of #remix-run/dev (#remix-run/dev->xdm->deasync). The install lifecycle hook for the deasync npm package makes a call to the node-gyp binary which doesn't exist in the sandbox and the bazel build command fails during setup. To fix this, I disabled the install lifecycle hook (I also disabled it with a pnpm install outside the sandbox and the remix build command executed perfectly) which led to the final error. Here's the error message for this error:
/Users/emmanuel/projects/bbbazel/BUILD.bazel:5:22: Running lifecycle hooks on npm package deasync#0.1.28 failed: (Exit 1): lifecycle-hooks.sh failed: error executing command (from target //:.aspect_rules_js/node_modules/deasync#0.1.28/lc) bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh deasync ../../../external/npm__deasync__0.1.28/package ... (remaining 1 argument skipped)
/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/node-gyp-bin/node-gyp: line 5: 1211: command not found
node-gyp not found! Please upgrade your install of npm! You need at least 1.1.5 (I think) and preferably 1.1.30.
> deasync#0.1.28 install /private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/deasync#0.1.28/node_modules/deasync
> node ./build.js
===============================================================
Failure while running lifecycle hook for package 'deasync#0.1.28':
Script: 'install'
Command: `node ./build.js`
Stack trace:
spawn ENOENT
at ChildProcess.<anonymous> (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/index.min.js:1:91930)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1100:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
The final error suggests a bug with remix, but since it only occurs in the bazel sandbox I think it may be an issue that cuts across bazel and remix. The error returned is shown below:
The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new
Missing output for entry point
Error
at Object.onCompileFailure (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/commands.js:180:13)
at Object.compile (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/compiler/remixCompiler.js:34:134)
at async Object.build (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/compiler/build.js:33:3)
at async Object.build (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/commands.js:175:3)
at async Object.run (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/run.js:449:7)
Building Remix app in production mode...
Target //examples/remix:build failed to build
I've tried to run it outside bazel and with pnpm (I added the override to the package.json for browserify-zlip#0.2.0, then I ran pnpm instal with --ignore-scripts flag) and it builds fine.
I'm not sure if this is a bug with remix or a bazel issue. Has anyone else experienced this? Or does anyone having a working version of remix with bazel as the build tool?
I've created a minified version of the repository in the state of the 3rd error https://github.com/noelenwenede/bbbazel. Start up instructions are in the readme file.

Gradle not working inside container but does outside

For some reason gradle is not working for me from w/in a docker container. Of course, outside the container it works fine. What's strange is that it doesn't say what file or directory is missing.
# ./gradlew clean -s
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'foo-bar'.
> Could not resolve com.google.protobuf:protobuf-gradle-plugin:0.8.9.
> Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-gradle-plugin/0.8.9/protobuf-gradle-plugin-0.8.9.pom'.
> org.apache.http.ssl.SSLInitializationException: (No such file or directory)
Caused by: java.io.FileNotFoundException: (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at org.gradle.internal.resource.transport.http.DefaultSslContextFactory$SslContextCacheLoader.initTrustManagerFactory(DefaultSslContextFactory.java:146)
at org.gradle.internal.resource.transport.http.DefaultSslContextFactory$SslContextCacheLoader.load(DefaultSslContextFactory.java:119)
... 248 more
Appears the problem was that javax.net.ssl.trustStore was being set to blank and overwriting the default, which also explains why FileNotFoundException appeared to not specify a value.

How to fix ' Error: Invalid or corrupt jarfile /root/.sbt/launchers/1.2.8/sbt-launch.jar'

I was following the tutorial Apache PredictionIO Docker.When I was the step "Build Template"
# pio-docker build --verbose
It went an error.
[root#docker01 MyRecommendation]# pio-docker build --verbose
[INFO] [Engine$] Using command '/usr/share/predictionio/sbt/sbt' at /templates/MyRecommendation to build.
[INFO] [Engine$] If the path above is incorrect, this process will fail.
[INFO] [Engine$] Uber JAR disabled. Making sure lib/pio-assembly-0.13.0.jar is absent.
[INFO] [Engine$] Going to run: /usr/share/predictionio/sbt/sbt package assemblyPackageDependency in /templates/MyRecommendation
[ERROR] [Engine$] Error: Invalid or corrupt jarfile /root/.sbt/launchers/1.2.8/sbt-launch.jar
[ERROR] [Engine$] Return code of build command: /usr/share/predictionio/sbt/sbt package assemblyPackageDependency is 1. Aborting.
[root#docker01 MyRecommendation]#
1.I've made the dirs
/templates/MyRecommendation
,I don't know some how why the command
pio-docker
,always need that dirs,nor the next dirs
templates/MyRecommendation
.My current dirs is
/root/predictionio/docker/templates/MyRecommendation
to execute the command
# pio-docker build --verbose
2.
/usr/share/predictionio/sbt/sbt
That file do not exists,before I made a softlinks to it.now if I execute it ,it works fine.In the original tutorial
Installing with Docker
,it didn't tell you to do it .
You must remove .sbt folder so fixed this error.

Jenkins Ruby metrics plugin fail to copy .gitkeep

Jenkins Ruby metrics plugin cause error when copy .gitkeep file to log directory, because it fails to create log directory.
Error message is below.
Publishing rcov report...
ERROR: Publisher hudson.plugins.rubyMetrics.rcov.RcovPublisher aborted due to exception
Failed to copy /Users/Shared/Jenkins/Home/jobs/RailsApp/workspace/log/.gitkeep to /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep due to failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:914)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:567)
at hudson.Util.copyFile(Util.java:922)
at hudson.FilePath$38$1.visit(FilePath.java:1937)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:131)
at hudson.FilePath$38.invoke(FilePath.java:1932)
at hudson.FilePath$38.invoke(FilePath.java:1925)
at hudson.FilePath.act(FilePath.java:914)
at hudson.FilePath.act(FilePath.java:887)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1925)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:28)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:12)
at hudson.plugins.rubyMetrics.HtmlPublisher.prepareMetricsReportBeforeParse(HtmlPublisher.java:30)
at hudson.plugins.rubyMetrics.rcov.RcovPublisher.perform(RcovPublisher.java:50)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:756)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
at hudson.model.Run.execute(Run.java:1695)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:512)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:899)
... 25 more
Jenkins didn't create log 'directory' but log 'file'. Jenkins have permission to read/write of the directory of course. Any ideas? Thanks in advance.
I spend a lot of time to fix this issue.
In fact, when you activate the Ruby metrics plugin, you have to provide a directory. If you don't, the default folder is log, and it is the cause of your error.
So, go to your project configuration and in the Publish Rcov Report section, you just fill the directory.
Enjoy :)

Blackberry JDE 6.0 VERIFIER ERROR And KXML 2

I am trying to import kxml2, what I did is I downloaded the lib, went to Project Explorer -> Properties -> Build Path -> Libraries, I include the kxml2-2.3.0.jar. I run compile and get this error
JAR file creation failed with error -1
The preverified classes if any are in tmp25754. See jar log of errors in C:\Users\sgil\AppData\Local\Temp\rapc_1296da5f.dir\jarlog.txt
Error!: Error: preverifier failed: C:\Program Files (x86)\Eclipse-Blackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components ...
Packaging project ** failed (took 0.795 seconds)
Error!: Error: preverifier failed: C:\Program Files (x86)\Eclipse-Blackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components ...
Packaging project ** failed (took 0.795 seconds)
I tried running the preverifier and I got this:
preverify -classpath "C:\Program Files (x86)\Eclipse-B
lackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components\lib\net_ri
m_api.jar" "C:\Users\sgil\Desktop\Projects\Blackberry****\lib\kxml2-2.3.0.
jar"
I get this error:
JAR file creation failed with error -1
The preverified classes if any are in tmp25503. See jar log of errors in output\
jarlog.txt
Any advice?
The solution to this is to put the correct PATH variable in the "Enviromental Variables" of the System(right click in My PC->Enviromental Variables).
If "PATH" already exists you need to add the path of the BIN of the JDK installed on the Computer.
The carpet you should add this is the bin:
for example: C:\PATH_TO_THE_INSTALLED_JDK\bin

Resources