How to deploy my maven project to heroku without Docker container

vinoth_ssv May 12, 2020

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
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 26, 2020

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.

0 votes
MigalLewis May 13, 2020

@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
AUG Leaders

Atlassian Community Events