mvn archetype:generate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
...생략
Choose archetype:
1: remote -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js)
2: remote -> am.ik.archetype:msgpack-rpc-jersey-blank-archetype (Blank Project for Spring Boot + Jersey)
...생략
1090: remote -> org.apache.maven.archetypes:maven-archetype-portlet (An archetype which contains a sample JSR-268 Portlet.)
1091: remote -> org.apache.maven.archetypes:maven-archetype-profiles (-)
1092: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
...생략
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1092: [엔터]
Choose version:
1: 1.0-alpha-1
2: 1.0-alpha-2
3: 1.0-alpha-3
4: 1.0-alpha-4
5: 1.0
6: 1.1
Choose a number: 6: [엔터]
Define value for property 'groupId': : com.example.app
Define value for property 'artifactId': : app
Define value for property 'version': 1.0-SNAPSHOT: : [엔터]
Define value for property 'package': com.example.app: : [엔터]
Confirm properties configuration:
groupId: net.madvirus
artifactId: sample
version: 1.0-SNAPSHOT
package: net.madvirus
Y: : [엔터]
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: net.madvirus
[INFO] Parameter: packageName, Value: net.madvirus
[INFO] Parameter: package, Value: net.madvirus
[INFO] Parameter: artifactId, Value: sample
[INFO] Parameter: basedir, Value:
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25:52 min
[INFO] Finished at: 2014-07-02T15:17:56+09:00
[INFO] Final Memory: 12M/111M
[INFO] ------------------------------------------------------------------------
tree
.
├─app
│ ├─src
│ │ ├─main
│ │ │ └─java
│ │ │ └─com
│ │ │ └─example
│ │ │ └─app
│ │ └─test
│ │ └─java
│ │ └─com
│ │ └─example
│ │ └─app
│ └─target
│ ├─classes
│ │ └─com
│ │ └─example
│ ├─generated-sources
│ │ └─annotations
│ └─maven-status
│ └─maven-compiler-plugin
│ └─compile
│ └─default-compile
<!--pom.xml-->
.
.
.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
mvn compile
├── build
│ ├── distributions
│ │ ├── bitcamp-java-project.tar <== Unix/Linux 사용자에게 배포하는 파일
│ │ └── bitcamp-java-project.zip <== Windows 사용자에게 배포하는 파일
배포 파일의 압축을 플고 그 안의 스크립트 파일을 실행해보자.
➜ distributions git:(master) ✗ tar -xvf *.tar <== 압축파일 푸는 명령어
➜ distributions git:(master) ✗ cd bitcamp-java-project
➜ bitcamp-java-project git:(master) ✗ tree
.
├── bin
│ ├── bitcamp-java-project
│ └── bitcamp-java-project.bat
└── lib
├── bitcamp-java-project.jar
├── checker-qual-2.11.1.jar
├── error_prone_annotations-2.3.4.jar
├── failureaccess-1.0.1.jar
├── guava-29.0-jre.jar
├── j2objc-annotations-1.3.jar
├── jsr305-3.0.2.jar
└── listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
2 directories, 10 files
➜ bitcamp-java-project git:(master) ✗ cd bin
➜ bin git:(master) ✗ ./bitcamp-java-project <== 스크립트 파일 실행
Hello world.
이때 Windows os의 경우 bat파일을 실행한다.
특히 우리가 만든 app.class 가 lib안의 bitcamp-java-project.jar에 있다.
여기에 있는 app.class를 실행하는 명령어가 bin에 있는 거!!! => 이게 바로 shell script이다.
이 스크립트는 고객 컴퓨터가 어떤지 모르니까 모든 경우의 수를 다 따져봐서 실행할 수 있게 만들어졌다.
개발자라면 그냥 jvm의 java 명령어로 실행할 수 있겠지만 빌드는 일반 사용자를 위해 배포파일을 만드는 과정이다.
gradle clean: 빌드한 걸 삭제하는 명령어