Liberty: Maven 아티팩트로서 설치
Liberty 서버는 Maven 아티팩트로서 설치될 수 있습니다. Maven 아티팩트로서 설치에는 두 가지 옵션이 있습니다. 하나는 Maven 설치 플러그인을 사용하는 것이며, 다른 하나는 Liberty 어셈블리 패키징 방법을 사용하는 것입니다.
Maven 설치 플러그인 사용
- 사용법:
maven-install-plugin을 사용하여 Maven 아티팩트로서 Liberty 서버 파일이 포함된 압축 아카이브를 설치할 수 있습니다. 압축된 아카이브는 iberty:package-server 목적 등으로 인해 생성할 수 있습니다.
- 예: 명령행 사용
mvn install:install-file -Dfile=/opt/ibm/wlp.zip \ -DgroupId=myGroup \ -DartifactId=myServer \ -Dversion=1.0 \ -Dpackaging=zip \
- 예: pom.xml 사용
- 사용 제품의 pom.xml 파일에서 사용할 수 있는 코드 스니펫입니다.
... <plugin> <!-- Install the Liberty server zip into the local Maven repository --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <version>2.2</version> <executions> <execution> <id>install-liberty-to-repo</id> <phase>process-resources</phase> <goals> <goal>install-file</goal> </goals> <configuration> <file>/opt/ibm/wlp.zip</file> <groupId>myGroup</groupId> <artifactId>myServer</artifactId> <version>1.0</version> <packaging>zip</packaging> </configuration> </execution> </plugin> ...
Liberty 어셈블리 사용
- 사용법:
liberty-assembly 패키징 유형을 사용하여 다른 서버 Maven 아티팩트 또는 압축 아카이브, 기존 서버 설치의 Liberty 서버 Maven 아티팩트를 작성할 수 있습니다. Maven compile 종속 항목으로서 지정된 애플리케이션은 기본적으로 dropins/ 디렉토리에서 어셈블된 서버와 자동으로 패키징됩니다.
- 예: Liberty 어셈블리 패키지 유형 사용
- 사용 제품의 pom.xml 파일에서 사용할 수 있는 코드 스니펫입니다.
<project> ... <groupId>myGroup</groupId> <artifactId>myServer</artifactId> <!-- Create Liberty server assembly --> <packaging>liberty-assembly</packaging> ... <dependencies> <!-- Package SimpleServlet.war with server assembly --> <dependency> <groupId>wasdev</groupId> <artifactId>SimpleServlet</artifactId> <version>1.0</version> <type>war</type> </dependency> </dependencies> ... <build> <plugins> <!-- Enable liberty-maven-plugin --> <plugin> <groupId>net.wasdev.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.2.1</version> <extensions>true</extensions> <configuration> <installDirectory>/opt/ibm/wlp</installDirectory> <serverName>test</serverName> </configuration> </plugin> </plugins> </build> ... </project>