[JAVA] [Maven] What to do if you are asked to incorporate a jar that is not in the remote repository into the war

Status

Passed a jar that is not in the Maven central repository or in-house repository, "Use this jar to solidify the war!" What to do if you are ordered to.

approach

  1. Execute the mvn install: install-file command to register it in the local repository (usually C: \ Users \ users \ .m2 \ repository on Windows).
  2. In pom.xml, set to refer to the jar registered in 1.

In particular,

If, type the following command. mvn install:install-file -Dfile=/lib/sample1.jar -DgroupId=jp.co.nannany -DartifactId=sample -Dversion=2.5.0 -Dpackaging=jar

Also, modify the pom.xml settings to refer to the files registered in the local repository.

<dependency>
    <groupId>jp.co.nannany</groupId>
    <artifactId>sample</artifactId>
    <version>2.5.0</version>
</dependency>

The war file that is hardened after doing these depends on the corresponding jar.

reference

http://www.ne.jp/asahi/hishidama/home/tech/apache/maven/local.html

https://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html

Recommended Posts

[Maven] What to do if you are asked to incorporate a jar that is not in the remote repository into the war
What to do if the changes are not reflected in the jar manifest file
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do if the Eclipse Maven dependency Jar is wrong
What to do if you are told "there is no main manifest attribute" when creating a jar file containing dependencies in a maven project
What to do if the prefix c is not bound in JSP
What to do if you get a javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake in the IBM JDK
What to do if you get a java.io.IOException in GlassFish
Memo that transitions to the login screen if you are not logged in with devise
[Ubuntu 20.04] What to do if the external monitor is not recognized
What to do if you get a gcc error in Docker
[Rails] What to do if data is not registered in DB
What to do when the changes in the Servlet are not reflected
What to do if Cloud9 is full in the Rails tutorial
What to do if you get a DISPLAY error in gym.render ()
What to do if you forget the root password in CentOS7
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
What to do if you select a JRE in Eclipse and get "The selected JRE does not support the current compliance level 11"
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do if you get a groovy warning in Thymeleaf Layout
What to do if the background image is not applied after deployment
What to do if you get a SQLite3 :: BusyException: database is locked error
What to do when you want to delete a migration file that is "NO FILE"
[Swift] What to do if the app icon is set but not reflected
Androd: What to do about "The Realm is already in a write transaction in"
What to do if you get an "A server is already running." Error when you try to start the rails server
What to do if you get Could not save master table to file after importing a project in Eclipse
How to translate the error message into Japanese (What to do if you cannot log in for some reason)
What to do about "A server is already running ..." that happened without turning off the rails server in the terminal
What to do if you accidentally create a model
What to do if you get a wrong number of arguments error in binding.pry
What to do if you can't get the text of an element in Selenium
What to do if the breakpoint is shaded and does not stop during debugging
[Java] What to do if the contents saved in the DB and the name of the enum are different in the enum that reflects the DB definition
[Solution] What to do if you get a Docker error'ERROR: Cannot connect to the Docker daemon at unix: ///var/run/docker.sock. Is the docker daemon running?'
A solution to an error that makes you angry that you are not following the MySQL default setting ONLY_FULL_GROUP_BY in a production environment and it is not unique.
What to do if you don't see the test code error message in the terminal console
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
What to do if audio is not available on discordrb
What to do if you installed Ruby with rbenv but the version does not change
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
What to do if you get a "302" error in your controller unit test code in Rails
What you need to do to open a file from the menu in the document-Based App macOS app
What to do if you can't use the rails command
[Rails] What to do if data is not registered in DB
What to do if the breakpoint is shaded and does not stop during debugging
What to do if the log using JUL is no longer output to the app log after deploying the Spring Boot app to Tomcat as a war
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
What to do when you want to know the source position where the method is defined in binding.pry
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do about the "cannot be read or is not a valid ZIP file" error
What to do if the app is not created with the latest Rails version installed when rails new
What to do when javax.el.ELException: Not a Valid Method Expression: appears when the JSF screen is displayed
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do when you run into a docker-compose node_modules problem
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
If you do not call shutdownNow when the transfer is completed in the Java SDK of AWS S3, threads will continue to remain
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if zip dies if there is a pom when making an executable jar with gradle
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
[Rails / Docker] What to do if access is denied by the browser (localhost: 3000) after adding a gem
What to do if you can't install the plugin from the Eclipse marketplace