heroku / heroku-buildpack-java Goto Github PK
View Code? Open in Web Editor NEWHeroku's buildpack for Java applications.
Home Page: https://devcenter.heroku.com/articles/java-support
License: MIT License
Heroku's buildpack for Java applications.
Home Page: https://devcenter.heroku.com/articles/java-support
License: MIT License
I'm seeing this error when running the buildpack:
2016-04-19T14:25:47.89-0500 [STG/0] OUT [ERROR] No plugin found for prefix 'dependency' in the current project and in the plugin groups [org.apache.maven.plug
ins, org.codehaus.mojo] available from the repositories [local (/tmp/cache/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
Please let me know if there is another forum more appropriate for these types of issues.
Mostly seeing this for connecting to private repos. Either offering this or some other solution to the problem is of growing importance.
The test script uses the mvn
directly ignoring all the settings that would have been set when using the run_mvn
function. Especially the custom settings.xml
is ignored which causes builds to compile, but fail during tests if there is still a dependency to download.
A workaround for now is to set the test script in app.json
:
"scripts": {
"test": "mvn -s settings.xml test"
},
but maybe it would be nice to make the buildpack consistently using the settings.xml
.
When using the buildpack the MAVEN_OPTS
env-var isn't used anymore.
To reproduce:
MAVEN_OPTS
variable to anything significant for the execution of the mvn
command.mvn
.when I manually set the buildpack to a previous commit it works OK:
https://github.com/heroku/heroku-buildpack-java.git#7aa61682516833fa876c209c4fdd52e145a2f47d
Hi,
I have changed build pack to read settings.xml from another location. The file has reference to environment variables. I used heroku config:add to set username and password of maven repo. However when it starts to run, I see the script compile is not able to read these env variables.
This is how my settings.xml look
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>archiva</id> <username>${env.MI-REPO-USER}</username> <password>#{env.MI-REPO-PASSWORD}</password> </server> </servers> </settings>
My compile script is changed to use this file hosted and print the credentials.
MAVEN_SETTINGS_URL="http://192.81.131.224/settings.xml" echo -n "-----> Installing settings.xml..." echo $MI_REPO_USER echo $MI_REPO_PASSWORD
When I do push on heroku I get empty values for MI_REPO_USER and MI_REPO_PASSWORD
Any help much appreciated
Nandish
Reproduce:
heroku/java
buildpack:Anything I'm missing to get this working?
PS I'm adding the java buildpack to run selenium tests for my node/react app in case that is useful info
I added this in the application.properties file of my spring boot app.
server.compression.enabled=true
In the localhost, gzip is working correctly. But in the heroku server, gzip header is missing and file is not being compressed. Any clue on how I can enable gzip for my java app? I am using jar deploy and no Procfile.
TEST SUITE: compile_test.sh
testCompileWithVendorFlagGetsSystemProperties
ASSERT:expected:<a5fa7b9982fc64939c0e215f935a850a /tmp/shunit.CpBISg/tmp/output.aqbq/cache/.m2/settings.xml> but was:<5df822de6968caeaa726d554e7021b89 /tmp/shunit.CpBISg/tmp/output.aqbq/cache/.m2/settings.xml>
testExistingAppDoesNotDownloadJDK
testNewAppGetsSystemPropertiesFile
testCompile
ASSERT:expected:<a5fa7b9982fc64939c0e215f935a850a /tmp/shunit.CpBISg/tmp/output.Yxju/cache/.m2/settings.xml> but was:<5df822de6968caeaa726d554e7021b89 /tmp/shunit.CpBISg/tmp/output.Yxju/cache/.m2/settings.xml>
testCompilationFailure
testDownloadCaching
testNewAppsRemoveM2Cache
testNonLegacyExistingAppsRemoveCache
testLegacyAppsKeepM2Cache
In my project, i do not have the pom.xml in my root, when i do a push, heroku says that my app was not detected. How can i specify where my pom.xml is ?
My pom.xml is in:
./app-name-serve/pom.xml
This may be a bit lame question. I am using spring MVC REST, Is there a way to enable gzip compression using Heroku build pack for that or is there any way by which I can change the server.xml?
I have this defined in my manifest.yml:
When I run:
cf push my-group-my-project-test
In my root directory, where pom.xml resides, I expected the application files to be uploaded, and the dependencies to be pulled down by maven on the platform.
What is happening is that everything on local, including dependencies, is being uploaded (to the tune of 56 megs). Am I missing the purpose of this buildpack? I thought the point was to download and cache the dependencies on the platform to improve performance.
A common practice is to bind jetty:run to the pre-integration-test phase; however, this phase/goal does not respect the skipTests=true
flag, so Jetty attempts to start itself during a build on Heroku. Jetty has a custom jetty.skip
flag in 6.1.26, so developers could add the following property to POMs to link this to the skipTests=true
flag, like this:
<properties>
<jetty.skip>${skipTests}</jetty.skip>
</properties>
However, this would have to be done on every POM, and I do not see any reason we would ever want Jetty to be started during a build, so this is a proposal to add -Djetty.skip=true
to the mvn
command for the Java buildpack.
Hi there,
we have a spring boot application which uses the maven wrapper but the buildpack does not detect the maven wrapper for the test setup. We went through the scripts and it should work but it doesn't
Do you have a suggestion what might go wrong?
The heroku/maven
Cloud Native Buildpack should use the slices feature to put the source code, dependencies, and compiled artifacts into their own layers.
Hi ,
I'm using a file in my WEB-INF folder , and i can't access it as
"serveletcon.getRealPath("/") " returns null , although i tried the same WAR file on a tomcat server on linux in other site and everything went right.
to be more descriptive in the problem , I use this code in my servlet :
System.out.println("servlet / : " + serveletcontext.getRealPath("/"));
and by viewing the logs , it produces this :
2014-04-15T17:55:40.418881+00:00 app[web.1]: servlet / : null
so , the function "getRealPath" doesn't return a path , even if i pass a "/" to it .
I opened a ticket in heroku and Damien (the developer who supported the ticket) told me that to be tracked , i should open an issue here on GitHub .
also i have searched and found these , please check :
http://cmhbl0g.blogspot.com/2013/12/heroku-reading-files-from-web-inf.html
http://ananthkannan.blogspot.com/2009/12/servletcontextgetrealpath-returns-null.html
Not sure if this is an issue, but annoys me a little bit.
If you deploy at first time one app, the addons included in bin/release get installed. If you specify a custom buildpack with different addons, the already ones installed don't change and the new ones specified in bin/release don't appear. After pushing changes noting happens neither.
Just wondering if this is a bug or a normal and expected behavior.
bin/release
is only used for new apps. Setup the $PATH
in a .profile.d/
script.
If no version is detected, the OpenJDK version is not printed.
e.g.
git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack... cloning with git...done
-----> Java app detected
-----> Installing OpenJDK ...done
-----> Installing Maven 3.0.3... done
I followed the instructions from:
https://devcenter.heroku.com/articles/local-maven-dependencies
When I push my app to Heroku it can not find the added jar in its local repository. This works fine on my local instance.
[ERROR] Failed to execute goal on project api: Could not resolve dependencies for project com.h2lo:api:jar:1.0: Could not find artifact pubnub:pubnub-java:jar:3.4 in project.local (file:/tmp/build_30y04zs5a9clk/repo) -> [Help 1]
Thoughts?
Thanks in advance.
Franz Garsombke
I got compilation problem when doing deployment on Heroku for my java class using class from jfxrt.jar.
May I know any solution for using OpenJDK?
The Maven Polyglot supports writing POM files in a variety of languages. To support it, bin/detect
needs to change so it accepts the other possible file extensions for the POM file.
When attempting builds with buildstep and herokuish, the error message
/dev/fd/63: line 124: ${BUILDPACK_LOG_FILE} : ambiguous redirect
is returned.
By setting the BUILDPACK_LOG_FILE variable in the shell session, the build completes successfully.
The NodeJS buildpack which also uses the buildpack-stdlib sets the variable in bin/complile:
https://github.com/heroku/heroku-buildpack-nodejs/blob/master/bin/compile#L30
Can the variable also be set bin/compile in this java buildpack?
buildpack-stdlib reference:
https://github.com/heroku/buildpack-stdlib/blob/master/stdlib.sh#L86
Hello,
I'm over 2 days trying to figure out what can be happening on my environment
When trying to rebuild an existing aplication I'm getting the following error:
/tmp/buildpacks/heroku-buildpack-java/bin/compile: line 43: detect_java_version: command not
Below is the command I'm executing...
Cloning into '/tmp/tmp.VjWEqvvaUa'...
done.
HEAD is now at 1924c62... Merge branch 'backlog#1234' into master_homolog
-----> Building myapp using buildstep...
-----> Installing ENV in build environment ...
-----> Using u1000 to run an application
-----> Java app detected
/tmp/buildpacks/heroku-buildpack-java/bin/compile: line 43: detect_java_version: command not found
Any help is more than welcome.
We started getting this error after this commit: db89ce6, looks like cache dir was not automatically created when writing the system.properties file to it.
buildpacks/java/bin/compile /var/EUAD4ABKBEIC7F63IDQJVTVF5ATUY6DZYKUQTKT2FUOR3Z76I5WQ/app-71 /var/EUAD4ABKBEIC7F63IDQJVTVF5ATUY6DZYKUQTKT2FUOR3Z76I5WQ/cache-71
-----> Installing JDK 1.8.../tmp/jvm-common/bin/java: line 302: /var/EUAD4ABKBEIC7F63IDQJVTVF5ATUY6DZYKUQTKT2FUOR3Z76I5WQ/cache-71/system.properties: No such file or directory
The buildpack downloads compiled maven archives from S3 (plus maven sources when building) over HTTP and then doesn't perform any additional (hash, signature) validation:
heroku-buildpack-java/lib/common.sh
Line 18 in 6f4efb3
heroku-buildpack-java/vendor/maven/package
Lines 13 to 17 in 210afcc
Both the S3 lang-jvm bucket and apache.org support HTTPS, so a s/http:/https:/
should work fine:
$ curl -IsSf https://lang-jvm.s3.amazonaws.com/maven-3.3.9.tar.gz | head -n 1
HTTP/1.1 200 OK
$ curl -IsSf http://apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz | head -n 1
HTTP/1.1 200 OK
Is it possible to just install Java without building apps with Maven? My use case is just to create an app that has both Node and Java environments (with multi-buildpack) to run Closure Compiler, so it does not actually need to build Java apps.
Use the scripts in heroku/heroku-buildpack-jvm-common instead of copy/paste between JVM buildpacks.
using any version of the buildpack later than the commit b7e7b29 breaks the use of Rhino JavaScript engine when using JDK 1.7.
As we tested in Heroku, we found out the file 'rhino.jar' is missing in the dir /app/.jdk/jre/lib/ when using any version of the buildpack after commit b7e7b29. It does exist when using a version of which this is the latest commit.
Pull java-agent into slugs so people can use it as needed.
Java 7 has had a few releases and it would be very nice if Heroku would support it with the official Java build pack.
Using the custom_settings branch allows for a settings.xml with a plain text pw to a secure repo to be added.
When an encrypted pw is used with a settings-security.xml is used the authentication fails on Heroku after working fine locally.
Perhaps another line in system.properties: maven.version=3.0.4
adding featured image for Elements Marketplace/Readme. Designed based on on Oracle guidelines here: http://www.oracle.com/us/technologies/java/java-licensing-logo-guidelines-1908204.pdf
Hi,
we want to use the buildpack in our on-premise cloud foundry installation.
Unfortunatly, we are behind a corportate proxy.
Could you list the URL we need to whiltelist to download maven/jdk/zulu-jdk?
Cheers
If I set my java version using system.properties
and later remove the file, the java version is still detected using the same version as set in the original system.properties
. e.g. If I set java.runtime.version=1.7, then delete system.properties, the next time I push, my app will still be using JDK 1.7.
Example:
~/dev/bare[master] ★ heroku create
Creating aqueous-anchorage-7595... done, stack is cedar
http://aqueous-anchorage-7595.herokuapp.com/ | [email protected]:aqueous-anchorage-7595.git
Git remote heroku added
~/dev/bare[master] ★ git push heroku master
Counting objects: 33, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (33/33), 3.64 KiB, done.
Total 33 (delta 8), reused 33 (delta 8)
-----> Java app detected
-----> Installing OpenJDK 1.6...done
...
~/dev/bare[master] ★ echo "java.runtime.version=1.7" > system.properties
~/dev/bare[master±] ★ git add .
~/dev/bare[master±] ★ git commit -m "java 7"
[master 8aa1eb9] java 7
1 file changed, 1 insertion(+)
create mode 100644 system.properties
~/dev/bare[master] ★ git push heroku master
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 299 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
-----> Java app detected
-----> Installing OpenJDK 1.7...done
...
~/dev/bare[master] ★ git rm system.properties
rm 'system.properties'
~/dev/bare[master±] ★ git commit -m "no java 7"
[master 810d13a] no java 7
1 file changed, 1 deletion(-)
delete mode 100644 system.properties
~/dev/bare[master] ★ git push heroku master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 219 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
-----> Java app detected
-----> Installing OpenJDK 1.7...done
We have a couple options. In both cases, we'll ignore any system.properties
found in the $CACHE_DIR
and default to JDK 1.6. We can:
I prefer the latter, but it means we'll start vendoring the JDK into all apps, not just net new. This seems fine since we've been vendoring the JDK into all new apps since September.
Another option, which I'm really not sure is possible, is to inspect the git history to see if the file has been removed. This would be backwards compatible, but I'm not sure what kind of performance problems it might introduce.
In /bin/test would it be a good idea to call "mvn verify" instead of "mvn test"? If you have integration tests with the maven-failsafe-plugin then they won't run with just the test goal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.