1
在我的项目,在捆绑模块,在resource
目录,我有我的示例startup.cfg
文件。该文件包含我想在启动时使用的属性。在捆绑pom.xml
我有以下。创建配置文件在Maven安装和没有或之前功能安装为Karaf
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/classes/startup.cfg</file>
<type>cfg</type>
<classifier>config</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
而在我的功能XML,我有,
<feature name="my-sample-feature" description="Sample service" version='${project.version}'>
<bundle>mvn:org.sample.app/service.implementation/{{VERSION}}</bundle>
<configfile finalname="/etc/org.sample.app.startup.cfg">mvn:mvn:org.sample.app/service.implementation/{{VERSION}}/cfg/config</configfile>
</feature>
在功能XML,我已经加入,
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>service.implementation</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>cfg</type>
</dependency>
此功能启动功能了。现在,当我将该功能安装在卡拉服务器中时,或者在此情况下,当我旋转卡拉夫时,只有etc/org.sample.app.startup.cfg
被创建。我的目标很简单,就是让这个conf文件始终在etc/
之间,独立于安装的功能。
我不明白。当你启动karaf功能安装,但配置文件没有创建?您发布的功能似乎格式错误,您是否可以粘贴部署到您的Maven存储库的feature.xml的确切内容? –
也许Maven程序集插件可以帮助(http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html) –