目录
1.前言
本章内容接第二篇 玩转OSGI-ApacheFelix(二)IDEA,注意介绍如何使用maven插件进行项目打包配置,后面内容可能会进行更新,根据目前掌握资料进行第一步记录汇总。
2.maven插件介绍
你可能会用到以下插件来实现你的需求,但是最重要的莫过于maven-bundle-plugin,这个插件用于OSGI配置打包,生成manifest文件,也就是配置元数据,进行打包配置描述,其他插件在java开发中应该或多或少都接触过,本章内容主要对maven-bundle-plugin进行说明
- maven-dependency-plugin
- maven-jar-plugin
- maven-bundle-plugin
- maven-assembly-plugin
- spring-boot-maven-plugin
3.maven-bundle-plugin
接第二章内容中的felix-client内容,给出一个示例pom配置
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>felix-demo</artifactId> <groupId>com.nxhz.felix</groupId> <version>1.0.4</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>felix-client</artifactId> <dependencies> <dependency> <groupId>com.nxhz.felix</groupId> <artifactId>felix-server</artifactId> <scope>provided</scope> </dependency> </dependencies> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> </execution>