Improved support for multi-module maven projects #210
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some steps in the maven plugin require paths to configuration files. For example eclipse formatter and scalafmt. In multi-module maven projects it is desirable to specify paths only once and not duplicate configs in multiple modules. Each sub-project should not assume anything about the general project structure and should not refer to files in parent modules using relative paths. It is recommended to create a separate module with configuration files and depend on it in the plugin. This approach is taken by the Checkstyle and PMD plugins:
http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html
https://maven.apache.org/plugins/maven-pmd-plugin/examples/multi-module-config.html
Such approach means configuration files no longer live within the project and might be inside a JAR. Thus specified value of
<file>
require special resolution.Both Checkstyle and PMD use builtin plexus
ResourceManager
which is able to locate files from regular file system, URL or JAR. Located file is then copied to the output directory (usually./target/
) and used as a regular file.This commit makes spotless plugin also use
ResourceManager
in order to support multi-module configuration with config files in a dedicated module. Every step that contains<file>
is updated to perform the resolution. It is also possible to specify configuration file URLs, though this feature is not tested.