The Inoyu OSGi Utilities Maven Plugin is a collection of utilities designed to help developers work with OSGi bundles in Maven projects. This plugin provides several goals to analyze and manage OSGi-related aspects of your project.
- Locate packages within project dependencies
- Analyze package usage in OSGi bundles
- View and validate OSGi bundle manifests
- Maven 3.3.9 or later
- Java 8 or later
This plugin can be used directly from the command line. Some goals require a Maven project context, while others can be used both within a project and independently.
This goal must be run within a Maven project context:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:locate-package -Dpackage=com.example.package1
This goal scans your project's dependencies and reports where the specified package is found.
Sample Output:
📦 Package found in Project classes
Dependency trail:
├─ dev.inoyu:osgi-tools:1.1
com/example/package1/Class1.class
com/example/package1/Class2.class
This goal must also be run within a Maven project context:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:find-package-usages -Dpackage=com.example.package
This goal examines your project and its dependencies to find where the specified packages are used.
Sample Output:
Searching for usages of package: com.example.package
📦 Usage found in Dependency: org.example:example-artifact:1.0: com/example/usage/Class1 uses com.example.package.Class2
Dependency trail:
├─ org.example:example-artifact:1.0
This goal can be used both within a Maven project context and independently:
-
Within a Maven project:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:view-manifest
This will display the manifest of the project's main artifact.
-
For arbitrary JAR files (can be used anywhere):
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:view-manifest -Djars=path/to/your/jar1.jar,path/to/your/jar2.jar
This goal displays the contents of the OSGi bundle manifest, including all headers and their values.
Sample Output:
Analyzing manifest of: path/to/your/jar1.jar
================================================================================
Bundle-Name: Example Bundle
Bundle-SymbolicName: com.example.bundle
Bundle-Version: 1.0.0
Export-Package: com.example.package;version="1.0.0"
Import-Package: org.osgi.framework;version="[1.3,2)"
================================================================================
The plugin supports the following parameters:
package
: The package name to search for or analyze (forlocate-package
andfind-package-usages
goals).jars
: A comma-separated list of paths to JAR files to analyze (optional forview-manifest
goal when used outside a project context).
-
Locate a package in a Maven project:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:locate-package -Dpackage=org.osgi.framework
-
Analyze package usage in a Maven project:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:find-package-usages -Dpackage=com.example.api
-
View manifest of the current Maven project:
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:view-manifest
-
View manifests of multiple JARs (can be used anywhere):
mvn dev.inoyu:osgi-utils-maven-plugin:1.2:view-manifest -Djars=/path/to/bundle1.jar,/path/to/bundle2.jar
- The
locate-package
andfind-package-usages
goals require a Maven project context and analyze the project's dependencies. - The
view-manifest
goal can be used both within a Maven project (without additional parameters) and independently to analyze arbitrary JAR files using the-Djars
parameter.
Contributions to the Inoyu OSGi Utilities Maven Plugin are welcome! Please submit pull requests or open issues on our GitHub repository.
This project is licensed under the Apache License 2.0.