최근 수행한 프로젝트에서 스프링부트로 만든 어플리케이션의 최종 빌드 모습은 다음과 같았다.
- myapp.war
- myapp-run.sh
- conf/application.properties
다음은 rpm-maven-plugin의 설정 예제이다.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<phase>none</phase>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>2016, MyCompany</copyright>
<group>Development</group>
<description>Maven Recipe: RPM Package.</description>
<version>${project.version}</version>
<release>0</release>
<autoRequires>false</autoRequires>
<preinstallScriptlet>
<scriptFile>src/main/package/rpm/preinstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preinstallScriptlet>
<defaultDirmode>755</defaultDirmode>
<defaultFilemode>644</defaultFilemode>
<defaultUsername>root</defaultUsername>
<defaultGroupname>root</defaultGroupname>
<mappings>
<mapping>
<directory>/usr/local/myapp</directory>
<sources>
<source>
<location>${project.basedir}/target/myapp-${project.version}.war</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/myapp</directory>
<filemode>755</filemode>
<sources>
<source>
<location>${project.basedir}/bin/myapp-run.sh</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/myapp/conf</directory>
<sources>
<source>
<location>${project.basedir}/conf</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
<mapping>에서 각 요소는 다음을 의미한다.
- <directory> : 파일 복사 위치. RPM 설치 과정에서 생성한다.
- <filemode> : 파일의 권한 모드
- <sources> : 해당 복사 위치에 넣을 대상