#2 pom.xml: karaf bundle uninstall & install
star
Tasks
- 이 방법을 사용하면 maven deploy시 karaf에 uninstall 및 install을 동시해 할 수 있어서 생산성에 도움이 됨
- 헤더에 Authorization 부분은 user, password 부분을 적절하게 맞춰줘야 하고
- karaf와 nexus간의 환경은 되어 있어야 함.
plugin#
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<inherited>false</inherited>
<executions>
...
</executions>
</plugin>
karaf uninstall#
<execution>
<id>bundle-uninstall</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>curl</executable>
<arguments>
<argument>-H</argument>
<argument>Authorization: Basic a2FgYWY6d2xyqWFnbw==</argument>
<argument>-H</argument>
<argument>Content-Type: application/json</argument>
<argument>-X</argument>
<argument>POST</argument>
<argument>-d</argument>
<argument>[
{
"type" :"EXEC",
"mbean": "org.apache.karaf:name=root,type=bundle",
"operation" :"uninstall(java.lang.String)",
"arguments" : ["${pom.artifactId}"]
}
]
</argument>
<argument>
http://localhost:8183/jolokia
</argument>
</arguments>
</configuration>
</execution>
karaf install#
<execution>
<id>bundle-install</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>curl</executable>
<arguments>
<argument>-H</argument>
<argument>Authorization: Basic a2FgYWY6d2xyqWFnbw==</argument>
<argument>-H</argument>
<argument>Content-Type: application/json</argument>
<argument>-X</argument>
<argument>POST</argument>
<argument>-d</argument>
<argument>[
{
"type" :"EXEC",
"mbean": "org.apache.karaf:name=root,type=bundle",
"operation" :"install(java.lang.String, boolean)",
"arguments" : ["mvn:${pom.groupId}/${pom.artifactId}/${pom.version}", "true"]
}
]
</argument>
<argument>
http://localhost:8183/jolokia
</argument>
</arguments>
</configuration>
</execution>
karaf maven 배포 실패시 Check 할 사항#
settings.xml 확인