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

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
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

89 views 7 6
Join discussion

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