Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to deploy my maven project to heroku without Docker container Edited

Hi All,

I have tired to deploy my jar file to heroku instance, below is my pipeline script which i used to deploy it in heroku.

but during build process, im unable deploy jar file to the heroku instead source of my git project has been deployed or uploaded to my heroku instance at /app .

can anybody help how to deploy jar file to the heroku using pipeline script .

# This is a sample build configuration for Java (Maven).

image: maven:3.6.1
clone:
depth: full

pipelines:
branches:
master:
- step:
name: Build and Deploy Snapshot Artifact
trigger: automatic
image: maven:3
caches: - maven # cache the maven
script:
-
mvn install clean
-
mvn package

-
step: name: Create artifact in HEROKU - Prod
deployment: production
script:
-
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:master
- mvn clean
- mvn install

 

2 answers

1 vote

Hi @vinoth_ssv ,

Thank you for your question!

Let's use heroku-deploy pipe in your case.

Also, we have an example of how to deploy a Java app with the heroku-deploy pipe.

@vinoth_ssv  I have successfully used a pipeline to deploy to heroku using the heroku-maven-plugin 

First add the plugin to your pom

<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<appName>migal-resume</appName>
<includeTarget>false</includeTarget>
<includes>
<include>${project.build.directory}/${project.build.finalName}.jar</include>
</includes>
<jdkVersion>1.8</jdkVersion>
<processTypes>
<web>java $JAVA_OPTS -jar target/${project.build.finalName}.jar -Dserver.port=$PORT</web>
</processTypes>
</configuration>
</plugin>

then  you will need to get your heroku api key and add it to your Deployment Variables in Btbucket

and then to deploy add - HEROKU_API_KEY=$HEROKU_API_KEY mvn heroku:deploy

# This is a sample build configuration for Java (Maven).

image: maven:3.6.1
clone:
depth: full

pipelines:
branches:
master:
- step:
name: Build and Deploy Snapshot Artifact
trigger: automatic
image: maven:3
caches: - maven # cache the maven
script:
-
mvn install clean
-
mvn package

-
step: name: Create artifact in HEROKU - Prod
deployment: production
script:
- HEROKU_API_KEY=$HEROKU_API_KEY mvn heroku:deploy

 

I hope this helps

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,323 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you