최근 수행한 프로젝트에서 스프링부트로 만든 어플리케이션의 최종 빌드 모습은 다음과 같았다.
- 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> : 해당 복사 위치에 넣을 대상
-
김범준 2016.08.14 14:08
안녕하세요, 맨날 도움만 받다가.. 어떻게 더 도움을 받을까 해서 글을 남깁니다.
저 역시 rpm 으로 릴리즈를 진행하는데, 맥 (혹은 윈도우) 상의 이클립스에서만 문제가 있어서요..
맥의 터미널이나 윈도우의 시그윈 상에서는 mvn install 로 문제 없이 빌드가 됩니다.
맥/윈도우 상의 이클립스에서 Run As -> Maven Install 로 빌드하면 다음과 같은 에러가 발생합니다.
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.4:rpm (generate-rpm) on project xxx: Unable to query for default vendor from RPM: Error while executing process. Cannot run program "rpm": error=2, No such file or directory -> [Help 1]
(편의상 프로젝트 네임은 숨겼습니다..)
맥에서의 rpm 은 brew install 로 설치했고, 윈도우는 시그윈에 바이너리가 포함되어 있습니다.
환경변수 문제가 아닐까 하여 여러 시도를 다 해보았으나.. 해결되지 않네요.
혹시 알고 계신 것이 있다면 말씀해 주실 수 있을까요?
미리 감사드립니다.-
최범균 madvirus 2016.08.18 08:10 신고
rpm이 실행 경로에 있어야 하니까, 이클립스에서 인식할 수 있게 시스템패스에 넣어주셔야 합니다. 터미널은 bash_profile과 같은 곳에서 설정해주지만, 거기에 설정한 환경 변수는 이클립스에 적용되지 않는 걸로 알고 있습니다.
전 쉘 외에 다른 프로그램에서 사용해야 하는 환경변수는 http://cooldevlife.blogspot.kr/2014/01/os-x.html 이 글 보고 설정했습니다.
더 좋은 방법은 아직 잘 모릅니다.
-