[JAVA] How to deploy an app that references a local jar to heroku

problem

If you write the following in Maven's pom.xml, an error will occur when deploying heroku. systemPath doesn't seem to allow it.

pom.xml


<dependency>
    <groupId>com.hoge</groupId>
    <artifactId>fuga</artifactId>
    <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${project.baseDir}/lig/fuga.jar</systemPath>
</dependency>

Solution

Working on the referencing project

Execute the following command in Maven.

command


mvn deploy:deploy-file -Durl=(1) -Dfile=(2) -DgroupId=com.hoge -DartifactId=fuga -Dpackaging=jar -Dversion=1.0.0
number Settings value
(1) Full path of the directory where the referenced project jar is placed file://~//repo
(2) Relative path of jar from referrer project root target/fuga-1.0.0-SNAPSHOT.jar

Executing the above command will create a jar file in the repo folder of the referenced project.

Working on the referenced project

Add the following contents to pom.xml.

pom.xml


<repositories>
  <repository>
    <id>project.local</id>
    <name>project</name>
    <url>file:${project.basedir}/repo</url>
  </repository>
</repositories>

<dependencies>
・ ・ ・
    <dependency>
    <groupId>com.hoge</groupId>
    <artifactId>fuga</artifactId>
    <version>1.0.0</version>
    <!--Remove scope and systemPath-->
  </dependency>
</dependencies>

Reference site

Recommended Posts

How to deploy an app that references a local jar to heroku
How to deploy to Heroku from a local docker image
How to deploy a simple Java Servlet app on Heroku
How to deploy on heroku
[iOS] [Objective-C] How to update a widget from an Objective-C app
How to deploy a kotlin (java) app on AWS fargate
How to add local jar to maven pom.xml
How to redo a deployment on Heroku
How to publish an application on Heroku
Deploy a Java web app on Heroku
How to make an app with a plugin mechanism [C # and Java]
How to deploy
How to deploy a container on AWS Lambda
How to create a class that inherits class information
How to build an executable jar in Maven
How to deploy a system created with Java (Wicket-Spring boot) to an on-campus server
How to run the SpringBoot app as a service
How to use an array for a TreeMap key
Steps to deploy to Heroku
How to push an app developed with Rails to Github
How to check CircleCI code and automatically deploy to Heroku
How to get started with creating a Rails app
I can't deploy! Resolve an error that can't be pushed to heroku (Rails Tutorial Chapter 1)
How to deploy VS Code Remote Containers in a docker-compose project that includes both the API and the front app
I want to write a loop that references an index with Java 8's Stream API
How to change a string in an array to a number in Ruby
How to specify db when creating an app with rails
How to deploy jQuery in your Rails app using Webpacker
How to make an app using Tensorflow with Android Studio
How to develop and register a Sota app in Java
Convert an array that may be null to a stream
How to deploy a Rails application on AWS (article summary)
Deploy Vapor Project to Heroku
How to leave a comment
How to handle an instance
How to insert a video
How to create a method
Create a Spring Boot web app that uses IBM Cloudant and deploy it to Cloud Foundry
How to create a jar file or war file using the jar command
How to make a jar file with no dependencies in Maven
How to implement a job that uses Java API in JobScheduler
How to create a new Gradle + Java + Jar project in Intellij 2016.03
How to identify the path that is easy to make a mistake
How to create a web server on an EC2 instance on AWS
I was able to deploy the Docker + laravel + MySQL app to Heroku!
When you receive a call, send an SMS to that number
How to deploy jQuery on Rails
How to add columns to a table
How to deploy Laravel on CentOS 7
How to make a Java container
How to sign a Minecraft MOD
How to make a JDBC driver
How to deploy Bootstrap on Rails
Deploy a war file on Heroku
[Java] How to create a folder
How to insert an external library
How to write a ternary operator
How to connect Heroku and Sequel
[Swift] How to send a notification
How to make a splash screen
How to make a Jenkins plugin