我是一名缺乏经验的 Java 和 Maven 开发人员,尽管几年前我已经使用 Karaf 3.0.1 版本进行了 karaf 组件构建。
尝试为自定义产品构建生成 karaf-assemby 4.0.5 时,maven 末尾不会创建 zip 和 tar.gz 文件 build 。每次运行 maven 构建时都会创建 ../target/assembly 目录,并且完成状态始终为“BUILD SUCCESS”。
我怀疑这是因为 POM 文件有一个错误,由 Eclipse IDE 在 部分为 karaf-maven-plugin 直接在 上突出显示。 行,如下:
生命周期配置未涵盖插件执行:org.apache.karaf.tooling:karaf-maven-plugin:4.0.5: assembly(执行:默认程序集,阶段:进程- 资源)
我可以通过删除“扩展”行来解决 IDE 中的此错误,但随后我收到“项目构建错误:未知的打包:karaf-assemble” “包装” 行出现错误。
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
**<!-- <extensions>true</extensions> -->**
<configuration>
<startupFeatures></startupFeatures>
<bootFeatures>
<feature>standard</feature>
<feature>management</feature>
<feature>jms</feature>
</bootFeatures>
<installedFeatures>
</installedFeatures>
</configuration>
</plugin>
我使用的POM文件如下:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.custom</groupId>
<artifactId>my.distribution</artifactId>
<version>1.0</version>
<packaging>karaf-assembly</packaging>
<!-- PIP Operations Aspect Assembly properties -->
<properties>
<maven-compiler-plugin-version>2.3.2</maven-compiler-plugin-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<assembly.directory>${project.build.directory}/assembly/karaf-4.0.5</assembly.directory>
<karaf.name>karaf</karaf.name>
<karaf.version>4.0.5</karaf.version>
<pip.name>Operations Aspect</pip.name>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>4.0.5</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>4.0.5</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<classifier>features</classifier>
<version>4.0.5</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>enterprise</artifactId>
<classifier>features</classifier>
<version>4.0.5</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>process-resources</id>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.0.5</version>
<extensions>true</extensions>
<configuration>
<startupFeatures></startupFeatures>
<bootFeatures>
<feature>standard</feature>
<feature>management</feature>
<feature>jms</feature>
</bootFeatures>
<installedFeatures>
</installedFeatures>
</configuration>
</plugin>
</plugins>
</build>
如有任何建议,我们将不胜感激。
最佳答案
您可能缺少执行设置:
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
<execution>
<id>package</id>
<goals>
<goal>archive</goal>
</goals>
</execution>
</executions>
关于java - karaf- assembly 4.0.5 - 成功的 Maven 构建结束时不会生成 zip ard tar.gz 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38835412/