https://github.com/scijava/scijava-maven-plugin
A Maven plugin to manage development of SciJava-based software.
https://github.com/scijava/scijava-maven-plugin
Last synced: 5 months ago
JSON representation
A Maven plugin to manage development of SciJava-based software.
- Host: GitHub
- URL: https://github.com/scijava/scijava-maven-plugin
- Owner: scijava
- License: bsd-2-clause
- Created: 2014-04-06T00:45:44.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-10-20T19:38:28.000Z (about 1 year ago)
- Last Synced: 2024-10-21T00:12:43.254Z (about 1 year ago)
- Language: Java
- Size: 3.48 MB
- Stars: 3
- Watchers: 17
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/scijava/scijava-maven-plugin/actions/workflows/build-main.yml)
[](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.scijava%22%20AND%20a%3A%22scijava-maven-plugin%22)
SciJava Maven Plugin
====================
scijava-maven-plugin is a Maven plugin for managing SciJava-based software.
Goals
-----
```shell
$ mvn scijava:help
[INFO] SciJava plugin for Maven 1.1.0
A plugin for managing SciJava-based projects.
This plugin has 7 goals:
scijava:bump
Bumps dependency and parent versions in SciJava projects.
scijava:populate-app
Copies .jar artifacts and their dependencies into a SciJava application
directory structure. ImageJ 1.x plugins (identified by containing a
plugins.config file) get copied to the plugins/ subdirectory and all other
.jar files to jars/. However, you can override this decision by setting the
scijava.app.subdirectory property to a specific subdirectory. It expects the
location of the SciJava application directory to be specified in the
scijava.app.directory property (which can be set on the Maven command-line).
If said property is not set, the populate-app goal is skipped.
scijava:eclipse-helper
Runs the annotation processor of the scijava-common artifact even inside
Eclipse.
scijava:help
Display help information on scijava-maven-plugin.
Call mvn scijava:help -Ddetail=true -Dgoal= to display parameter
details.
scijava:install-artifact
Downloads .jar artifacts and their dependencies into a SciJava application
directory structure. ImageJ 1.x plugins (identified by containing a
plugins.config file) get copied to the plugins/ subdirectory and all other
.jar files to jars/. However, you can override this decision by setting the
scijava.app.subdirectory property to a specific subdirectory. It expects the
location of the SciJava application directory to be specified in the
scijava.app.directory property (which can be set on the Maven command-line).
If said property is not set, the install-artifact goal is skipped.
scijava:set-rootdir
Sets the project.rootdir property to the top-level directory of the current
Maven project structure.
scijava:verify-no-snapshots
Mojo wrapper for the SnapshotFinder.
Parameters:
- failFast - end execution after first failure (default: false)
- groupIds - an inclusive list of groupIds. Errors will only be reported for
projects whose groupIds are contained this list. (default: empty - all
groupIds considered)
- groupId - Singular groupIds option. Will be appended to groupIds if both are
specified.
```
Usage
-----
It is recommended to enable the _set-rootdir_ as well as the _populate-app_
goal by making the [SciJava POM](http://github.com/scijava/pom-scijava)
the parent project:
```xml
org.scijava
pom-scijava
7.5.2
...
```
Alternatively, you can include the plugin explicitly in the life cycle:
```xml
org.scijava
scijava-maven-plugin
0.1.0
set-rootdir
validate
set-rootdir
populate-app
install
populate-app
```
SciJava Packages Rules
====================
scijava-packages-rules provides a set of [Maven Enforcer Plugin](https://maven.apache.org/enforcer/maven-enforcer-plugin/) rules for policing the package hierarchy at build time.
## Usage
Currently, the only way to utilize these rules is by explicitly declaring it in the life cycle
```xml
maven-enforcer-plugin
org.scijava
scijava-packages-rules
0-SNAPSHOT
...
```
Rules
====================
# No Package Cycles
[Circular dependencies](https://en.wikipedia.org/wiki/Circular_dependency) are usually considered poor practice. To prevent circular dependencies, add the following `execution`:
```xml
enforce-no-package-cycles
enforce
test
```
### Including test classes
If you want to exclude tests from cycle checking, you can use the parameter `includeTests` which is set to true by default:
```xml
...
false
...
```
### Restricting scope
**:warning: Only use this, if there is no other way! Once there are exceptions, the connection between those excluded packages
will grow stronger and stronger, without notice!**
If you want to exclude packages or restrict check to certain packages only, you can use `includedPackages` or `excludedPackages` (although you really should not!):
```xml
...
myapp.code.good
...
```
```xml
...
myapp.code.bad
...
```
# No Subpackage Dependence
Subpackage Dependence can throw a wrench into libraries wishing to follow the [Dependency Inversion principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle). To prevent subpackage dependence, add the following `execution`:
```xml
enforce-no-subpackage-dependence
enforce
test
```
## See also
* The original version by Daniel Seidewitz on [Stackoverflow](http://stackoverflow.com/questions/3416547/maven-jdepend-fail-build-with-cycles). Improved by showing all packages afflicted with cycles and the corresponding classes importing the conflicting packages; this version was written [here](https://github.com/andrena/no-package-cycles-enforcer-rule). From there, the SciJava team made the behavior more extensible, making it easier to write and use more package-based rules.
* [JDepend](https://github.com/clarkware/jdepend), the library being used to detect package cycles.
* For more information about package cycles, see ["The Acyclic Dependencies Principle" by Robert C. Martin (Page 6)](http://www.objectmentor.com/resources/articles/granularity.pdf).
* The [Maven Enforcer Plugin](https://maven.apache.org/enforcer/maven-enforcer-plugin/)