Java Build
Written By Young-rae Shin(https://github.com/lived1024)
IntelliJ
- File -> Project Structure

 - Artifacts -> JAR -> From modules with dependencies

 - 
    
Default setting

If you want to make executable jar
Please check MANIFEST.MF path at Default setting

Change path! (java -> resources)

 - A screen similar to the following is displayed

 - Confirm Main-Class at MANIFEST.MF

 - Build -> Build Artifacts

 - First, Clean => Second, Build

 - Confirm JAR file in project base directory

 
Maven
- Install Maven
The screen below can be seen after installation
 - Go to the project directory where you want to build module(“pom.xml” is located)

 - Open console(like cmd, git-bash, terminal, etc…)

 - Start build : Use maven build command
You need to study maven command.$ mvn clean package -Dmaven.test.skip=true $ mvn clean package spring-boot:repackage -Dmaven.test.skip=true
 - If you see “BUILD SUCCESS”, it’s complete
  
 
Add custom jar file to maven project
- Open pom.xml
 - Add local repository or jar files!!
if you want to add local repository in pom.xml<repositories> <repository> <id>local-repo</id> <name>local</name> <url>file://${project.basedir}/lib</url> </repository> </repositories>OR add local jar files in pom.xml like this
<dependencies> <dependency> <groupId>org.chronotics</groupId> <artifactId>pandora</artifactId> <version>1.4-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/lib/pandora.jar</systemPath> </dependency> //set scope(system) and systemPath(jar file's path) <dependency> <groupId>com.vcanus</groupId> <artifactId>pithos-nosql</artifactId> <version>0.0.1-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/lib/pithos-nosql.jar</systemPath> </dependency> <dependencies> 
How to run jar file
- Go to the project directory where you want to run jar file located
 - Open console
 - Input command
    
$ java -jar filename.jar
 
 
Leave a comment