[메이븐] compile 과 install 차이점

프로그래밍/서버2021. 4. 18. 16:59

*mvn compile 했을 때

"C:\Program Files\Java\openjdk-8u272-b10-windows-64\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\lib\idea_rt.jar=63560:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.1 compile
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< com.dreamaz.gongga:common >----------------------
[INFO] Building common 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kotlin-maven-plugin:1.4.31:kapt (kapt) @ common ---
[WARNING] Source root doesn't exist: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\src\main\java
[INFO] Applied plugin: 'spring'
[INFO] Applied plugin: 'jpa'
[INFO] Applied plugin: 'no-arg'
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- kotlin-maven-plugin:1.4.31:compile (compile) @ common ---
[INFO] Applied plugin: 'spring'
[INFO] Applied plugin: 'jpa'
[INFO] Applied plugin: 'no-arg'
[WARNING] Duplicate source root: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\generated-sources\kapt\compile
[WARNING] Duplicate source root: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\generated-sources\kaptKotlin\compile
[WARNING] C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\src\main\kotlin\com\dreamaz\gongga\common\util\DateUtil.kt: (19, 17) Variable 'monthRangeArray' is never used
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (java-compile) @ common ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.431 s
[INFO] Finished at: 2021-04-18T16:55:57+09:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

 

*mvn install 했을 때

"C:\Program Files\Java\openjdk-8u272-b10-windows-64\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\lib\idea_rt.jar=63536:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.1 install
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< com.dreamaz.gongga:common >----------------------
[INFO] Building common 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kotlin-maven-plugin:1.4.31:kapt (kapt) @ common ---
[WARNING] Source root doesn't exist: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\src\main\java
[INFO] Applied plugin: 'spring'
[INFO] Applied plugin: 'jpa'
[INFO] Applied plugin: 'no-arg'
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- kotlin-maven-plugin:1.4.31:compile (compile) @ common ---
[INFO] Applied plugin: 'spring'
[INFO] Applied plugin: 'jpa'
[INFO] Applied plugin: 'no-arg'
[WARNING] Duplicate source root: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\generated-sources\kapt\compile
[WARNING] Duplicate source root: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\generated-sources\kaptKotlin\compile
[WARNING] C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\src\main\kotlin\com\dreamaz\gongga\common\util\DateUtil.kt: (19, 17) Variable 'monthRangeArray' is never used
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (java-compile) @ common ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\src\test\resources
[INFO] 
[INFO] --- kotlin-maven-plugin:1.4.31:test-compile (test-compile) @ common ---
[WARNING] No sources found skipping Kotlin compile
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (java-test-compile) @ common ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ common ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ common ---
[INFO] Building jar: C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\common-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ common ---
[INFO] Installing C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\common-0.0.1-SNAPSHOT.jar to C:\Users\mazend\.m2\repository\com\dreamaz\gongga\common\0.0.1-SNAPSHOT\common-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\pom.xml to C:\Users\mazend\.m2\repository\com\dreamaz\gongga\common\0.0.1-SNAPSHOT\common-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.697 s
[INFO] Finished at: 2021-04-18T16:54:25+09:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

 

mvn install의 로그가 더 깁니다.

여기서 주목해서 봐야할 부분은 바로 아래의 부분입니다.(mvn install)

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ common ---
[INFO] Installing C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\target\common-0.0.1-SNAPSHOT.jar to C:\Users\mazend\.m2\repository\com\dreamaz\gongga\common\0.0.1-SNAPSHOT\common-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\mazend\IdeaProjects\gongga_spring\gongga\common\pom.xml to C:\Users\mazend\.m2\repository\com\dreamaz\gongga\common\0.0.1-SNAPSHOT\common-0.0.1-SNAPSHOT.pom

compile의 결과물을 아래와 같은 local repository로 복사합니다. 이렇게 해야 다른 프로젝트에서 이 jar를 dependency로 사용할 수 있습니다.

C:\Users\mazend\.m2\repository\com\dreamaz\gongga\common\0.0.1-SNAPSHOT\common-0.0.1-SNAPSHOT.jar

 

 

  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

참고

maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

 

Maven – Introduction to the Build Lifecycle

The build lifecycle is simple enough to use, but when you are constructing a Maven build for a project, how do you go about assigning tasks to each of those build phases? The first, and most common way, is to set the packaging for your project via the equa

maven.apache.org

 

작성자

Posted by 드리머즈

관련 글

댓글 영역