I downloaded the cf java buildpack zip from https://github.com/cloudfoundry/java-buildpack and unzipped it(on a windows 7 machine). I made some changes and created a custom buildpack by creating a zip file(By simply compressing to zip and not using buildpack packager). Now my app deployment is failing with error:
2017-05-23T15:14:03.19+0000 [STG/17] OUT -----> Downloaded app package (59M)
2017-05-23T15:14:03.36+0000 [STG/0] OUT Staging failed: Buildpack compilation step failed
2017-05-23T15:14:03.36+0000 [STG/0] ERR
2017-05-23T15:14:03.46+0000 [API/0] ERR encountered error: App staging failed in the buildpack compile phase
These are the only error logs even after setting CF_TRACE=true. Please suggest how to see more descriptive logs on buildpack compilation or any tool which may help in debugging.
Thanks in advance.
I made some changes and created a custom buildpack by creating a zip file(By simply compressing to zip and not using buildpack packager).
Don't do that. If you need a build pack to upload to your CF foundation, then use the instructions here to build a proper build pack.
https://github.com/cloudfoundry/java-buildpack/#building-packages
Brief Instructions:
Install Ruby
git clone https://github.com/cloudfoundry/java-buildpack.git
cd java-buildpack
git checkout <version> ex: git checkout v3.16
bundle install
bundle exec rake clean package for a version without dependencies or bundle exec rake clean package OFFLINE=true PINNED=true for a version with dependencies.
or
If you don't need a build pack to upload and just want to test your changes then...
Fork the Java build pack.
Make your changes.
Push them to your fork.
Run cf push -b <url-to-your-git-project>. Ex: cf push -b https://github.com/dmikusa-pivotal/java-buildpack.
This will instruct the single app to use your copy of the build pack. This will only work if your CF foundation has network access to the Git URL specified.
Hope that helps!
Related
I created spring + angular + gradle with Jhipster.
I first do
npm install
Then , I run this command:
./gradlew -Pprod -Pwar clean bootWar
which reads gradle/war.gradle:
apply plugin: "war"
bootWar {
mainClassName = "com.bpn.legolas.ExtractAccountApp"
includes = ["WEB-INF/**", "META-INF/**"]
webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml")
}
war {
webAppDirName = "build/resources/main/static/"
webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml")
enabled = true
archiveExtension = "war.original"
includes = ["WEB-INF/**", "META-INF/**"]
}
and it creates a war. But when i deploy to another machine, to tomcat, i got the error page:
An error has occured :-( Usual error causes You started the
application from an IDE and you didn't run npm start or npm run
webpack:build. You had a network error while running npm install. If
you are behind a corporate proxy, it is likely that this error was
caused by your proxy. Have a look at the JHipster error logs, you will
probably have the cause of the error. You installed a Node.js version
that doesn't work with JHipster: please use an LTS (long-term support)
version, as it's the only version we support. Building the client side
code again If you want to go fast, run ./mvnw to build and run
everything.
If you want to have more control, so you can debug your issue more
easily, you should follow the following steps:
Install npm dependencies with the command npm install Build the client
with the command npm run webpack:build or npm start Start the server
with ./mvnw or using your IDE Getting more help If you have a question
on how to use JHipster Go to Stack Overflow with the "jhipster" tag.
If you have a bug or a feature request First read our contributing
guidelines.
Then, fill a ticket on our bug tracker, we'll be happy to resolve your
issue!
If you want to chat with contributors and other users Join our chat
room on Gitter.im. Please note that this is a public chat room, and
that we expect you to respect other people and write in a correct
English language!
For same steps, i export as jar.
First
npm install
Then
./gradlew -Pprod -Pjar clean bootJar
Than at that machine, i do
java -jar xxxx.jar
and it works! But for war, as i said before, it does not work. It says about npm install orwebpack`
Please help me about it.
STEPS
1- My war name is halil-0.0.1-SNAPSHOT.war
2- I put to webapps under tomcat
3- Then i go to:
http://localhost:8080/halil-0.0.1-SNAPSHOT/
4- I see the errors which i put in the screenshot.
Which i posted as text in this question
5- Javascript console shows those errors:
6- Network shows those errors:
7- When i go to
http://localhost:8080/halil
or
http://localhost:8080/
it brings 404 page
I had the same problem when I was trying to migrate from Angular 4 to Angular 12 in my Jhipster project.
The issue was that the static folder was not being created before creating the war:
gradle script was wrong (the npm build was running in the correct step before the war)
So I have solved it following these steps:
Run npm build, so the static folder was created (you must be sure the exact path for your static folder is correct)
Check if the static folder was created in the path your war is expecting
Run ./gradlew -Pprod -Pwar clean bootWar
I am trying to install parquet tools on a FreeBSD machine.
I cloned this repo: git clone https://github.com/apache/parquet-mr
Then I did cd parquet-mr/parquet-tools
Then I did `mvn clean package -Plocal
As specified here: https://github.com/apache/parquet-mr/tree/master/parquet-tools
This is what I got:
Why is this dependency error here? How do I get around it?
On Ubuntu 20, I install via pip:
python3 -m pip install parquet-tools
Haven't tried on FreeBSD but I'd imagine it would also work. See related answer for a caveat on using pip on FreeBSD.
And you can view a file with:
parquet-tools show filename.parquet
I know the question specifies FreeBSD, but if you're on mac, you can do
brew install parquet-tools
parquet-tools is just one module of parquet-mr. It depends on some of the other modules.
When you build from a source version that corresponds to a release, those other modules will be available to Maven, because release artifacts are published as a part of the release process.
However, when building from a snapshot version, you have to make those dependencies available yourself. There are two ways to do so:
Option 1: Build and install all modules of the parent directory:
git clone https://github.com/apache/parquet-mr
cd parquet-mr
mvn install -Plocal
This will put the snapshot artifacts in your local ~/.m2 directory. Subsequently, you can (re)build just parquet-tools like you initially tried, because now the snapshot artifacts will already be available from ~/.m2.
Option 2: Build the parquet-mr modules from the parent directory, while asking Maven to build needed modules as well along the way:
git clone https://github.com/apache/parquet-mr
cd parquet-mr
mvn package -pl parquet-tools -am -Plocal
Option 1 will build more projects than option 2, so if you only need parquet-tools, you are better off with the latter. Please note though that probably both will require installation of a thrift compiler.
Parquet tools- A utility that can be leveraged to read parquet files. Yuu can clone it from Github and run some maven command.
1. git clone https://github.com/Parquet/parquet-mr.git
2. cd parquet-mr/parquet-tools/
3. mvn clean package -Plocal
OR You can download stable release & built from local.
Downloading stable Parquet release.
https://github.com/apache/parquet-mr/archive/apache-parquet-1.8.2.tar.gz
2. Maven local install.
D:\parquet>cd parquet-tools && mvn clean package -Plocal
3. Test it (paste a parquet file under target directory):
D:\parquet\parquet-tools\target>java -jar parquet-tools-1.8.2.jar schema out.parquet
(where out.parquet is my parquet file under target directory)
// Read parquet file
D:\parquet\parquet-tools\target>java -jar parquet-tools-1.6.0.jar cat out.parquet
// Read few lines in parquet file
D:\parquet\parquet-tools\target>java -jar parquet-tools-1.6.0.jar head -n5 out.parquet
Some answers have broken link for the jar download, but you can get it from
maven central
However... this jar and others like it are built so that the hadoop dependencies are "provided" and if you build from source, you'll get that default. So you need to set -Dhadoop.scope=compile when you build, or the result will only work when run on a hadoop node using the "hadoop ..." command.
To make matters worse, this tool apparently disables System.out and System.err so that exceptions that cause main() fails are never printed and you'll be left wondering what happened.
I also found that the default settings for the maven-license-plugin caused it to fail the build when files showed up that it didn't expect (e.g. nbactions.xml if you use netbeans).
OpenDaylight Oxygen
Maven 3.3.9
Ubuntu 16.04
karaf 4
~/.m2/settings.xml - cp -n ~/.m2/settings.xml{,.orig} ; wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
Process used to create skeleton
mvn archetype:generate -DgroupId=org.opendaylight.controller -DartifactId=testing -Dcopyright="None" -DclassPrefix="\${artifactId.substring(0,1).toUpperCase()}\${artifactId.substring(1)}" -DarchetypeGroupId=org.opendaylight.archetypes -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeVersion=1.1.0-SNAPSHOT -DinteractiveMode=false
mvn clean install -Dcheckstyle.skip
I'm trying to build a sample app and deploy it on a separate instance of ODL (karaf 4). I cannot find a working answer to this anywhere.
I've tried copying the contents of PROJECT/karaf/target/assembly/system/org/opendaylight/controller to the equivalent folder on the other ODL instance. Then used feature:add-repo to add the feature. It was able to detect the plugin, but feature:install odl-testing failed to install.
Any help would be greatly appreciated.
You are not showing what exact failure you hit when you say "feature:install odl-testing failed to install", but FYI most people don't actually use the process you are trying to get working.. it's technically possible to build your new bundles and Karaf feature separately and then manually add it to deploy on a separate instance of ODL... but every project I know of finds it easier to just let the build produce a ready-to-use Karaf distribution.
You have probably seen the distro in karaf/target/assembly which the the ODL archetype (documented here BTW; note the use of archetypeGroupId changed to org.opendaylight.archetypes in the just released latest Fluorine version) produces?
So what you can do instead is to just add your "base" feature which you are presumably wanting to add your feature into as a dependency to your custom feature. With this, you get your ready-to-run custom distribution including your new code and whatever other ODL features you want to include.
I am trying to build and CI environment and I think that it works because I can publish a jar into Nexus automatically.
Git
BitBucket
Jenkins
Nexus OSS
I am looking information about the deployment of maven projects automatically when it publish to nexus , but I am not sure about my initial idea.
My initial idea is to download the latest artifact from Nexus3 and use mvn spring-boot:run but I am not sure about my decission.
I read information about Puppet but I am not sure about this option, could anyone help to me about this process ? Or send to me another link in the StackOVerflow about this problem.
Regards !
Build a pipeline in Jenkins:
First job builds an artifacts and uploads it to the storage (in your case it's Nexus). It has to determine which version it uploaded - the easiest way to do that is to set the version by the job itself and then upload the known version (see a sample script at the bottom).
Then pass the known version to the downstream jobs (like deploying to envs). You'd need to tell Jenkins which version you just deployed - it's possible to write it into a key-value file and then use something like EnvInject plugin to read it as an env var.
To download an artifact from Nexus use wget/curl:
http://nexus.domain/nexus/service/local/artifact/maven/redirect?r={repository}&g={groupId}&a={artifactId}&v={version}&p={type}
Jenkins has several plugins for building pipelines, but you can start with a simple built-in possibility of jobs to invoke other jobs.
Couple of notes:
Do not use Maven for deployment. Maven is a build tool, it's not suitable for deployments. Write bash scripts and possibly use Docker for deployment automation.
Do not use LATEST/SNAPSHOT/RELEASE versions - you need to have a deterministic deployment (if it's repeated with the same params it deploys the same artifact).
A sample script that sets a snapshot-like version (so it's possible to upload the artifact to snapshot Maven repo):
VERSION=`mvn help:evaluate -Dexpression=project.version | grep -v "^\["| grep -v Download`
VERSION=${VERSION/%-SNAPSHOT/} #get rid of -SNAPSHOT if it's there
VERSION="$VERSION-"`date +"%Y%m%d.%H%M%S"`"-$BUILD_NUMBER"
mvn versions:set -DnewVersion=$VERSION
I build an Apache Project in java which runs fine on my laptop, now that I try to run the same project in Netbeans on my work PC I get an error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
With a reference to:
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The Maven plugin in Netbeans was installed by default. When I tried to find out if the Apache version in the POM file was correct I tried to check the version on my PC with mvn -version I got the error:
'mvn' is not recognized as an internal or external command,
operable program or batch file.
Does this mean that Maven is not installed on my PC and should I also install Maven on my PC first in order to use the plugin, or should just installing the plugin be enough and do I have a different problem?
The error message you see is
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
This is a message from the Maven executable embedded inside Netbeans (so Maven is running), saying that a specific maven plugin (here exec-maven-plugin) failed. This is most likely trying to invoke another program on your computer that is not installed so Netbeans (and hence the embedded Maven) can see it.
If you want to run maven outside Netbeans, you must download and install a copy and invoke the "mvn" binary inside.
You Have to install Maven To run Maven on your PC - http://www.avajava.com/tutorials/lessons/what-is-maven-and-how-do-i-install-it.html see how to install maven
in linux - http://www.mkyong.com/maven/how-to-install-maven-in-ubuntu/
I mistakenly assumed that the problem had something to do with Maven, the problem seems to be something in my source code unrelated to Maven. When I change some of the code the program is build succesfully