-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted common parameters of Mojo to abstract parent. Added test fo…
…r plugin description
- Loading branch information
Showing
8 changed files
with
400 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
Name: SortPom Plugin | ||
Description: A Maven plugin that sorts the pom.xml file. | ||
Group Id: com.github.ekryd.sortpom | ||
Artifact Id: sortpom-maven-plugin | ||
Version: @pom.version@ | ||
Goal Prefix: sortpom | ||
|
||
This plugin has 3 goals: | ||
|
||
sortpom:help | ||
Description: Display help information on sortpom-maven-plugin. | ||
Call mvn sortpom:help -Ddetail=true -Dgoal=<goal-name> to display parameter | ||
details. | ||
Implementation: sortpom.HelpMojo | ||
Language: java | ||
|
||
Available parameters: | ||
|
||
detail (Default: false) | ||
User property: detail | ||
If true, display all settable properties for each goal. | ||
|
||
goal | ||
User property: goal | ||
The name of the goal for which to show help. If unspecified, all goals | ||
will be displayed. | ||
|
||
indentSize (Default: 2) | ||
User property: indentSize | ||
The number of spaces per indentation level, should be positive. | ||
|
||
lineLength (Default: 80) | ||
User property: lineLength | ||
The maximum length of a display line, should be positive. | ||
|
||
sortpom:sort | ||
Description: Sorts the pom.xml for a Maven project. | ||
Implementation: sortpom.SortMojo | ||
Language: java | ||
Bound to phase: validate | ||
|
||
Available parameters: | ||
|
||
backupFileExtension (Default: .bak) | ||
User property: sort.backupFileExtension | ||
Name of the file extension for the backup file. | ||
|
||
createBackupFile (Default: true) | ||
User property: sort.createBackupFile | ||
Should a backup copy be created for the sorted pom. | ||
|
||
encoding (Default: UTF-8) | ||
User property: sort.encoding | ||
Encoding for the files. | ||
|
||
expandEmptyElements (Default: true) | ||
User property: sort.expandEmptyElements | ||
Should empty xml elements be expanded or not. Example: | ||
<configuration></configuration> or <configuration/> | ||
|
||
ignoreLineSeparators (Default: true) | ||
User property: sort.ignoreLineSeparators | ||
Ignore line separators when comparing current POM with sorted one | ||
|
||
indentBlankLines (Default: false) | ||
User property: sort.indentBlankLines | ||
Should blank lines (if preserved) have indentation. | ||
|
||
keepBlankLines (Default: false) | ||
User property: sort.keepBlankLines | ||
Should blank lines in the pom-file be preserved. A maximum of one line is | ||
preserved between each tag. | ||
|
||
lineSeparator (Default: ${line.separator}) | ||
User property: sort.lineSeparator | ||
Line separator for sorted pom. Can be either \n, \r or \r\n | ||
|
||
nrOfIndentSpace (Default: 2) | ||
User property: sort.nrOfIndentSpace | ||
Number of space characters to use as indentation. A value of -1 indicates | ||
that tab character should be used instead. | ||
|
||
pomFile (Default: ${project.file}) | ||
User property: sort.pomFile | ||
This is the File instance that refers to the location of the pom that | ||
should be sorted. | ||
|
||
predefinedSortOrder | ||
User property: sort.predefinedSortOrder | ||
Choose between a number of predefined sort order files. | ||
|
||
skip (Default: false) | ||
User property: sort.skip | ||
Set this to 'true' to bypass sortpom plugin | ||
|
||
sortDependencies | ||
User property: sort.sortDependencies | ||
Comma-separated ordered list how dependencies should be sorted. Example: | ||
scope,groupId,artifactId. If scope is specified in the list then the | ||
scope ranking is COMPILE, PROVIDED, SYSTEM, RUNTIME, IMPORT and TEST. The | ||
list can be separated by ',;:' | ||
|
||
sortModules (Default: false) | ||
User property: sort.sortModules | ||
Should the Maven pom sub modules be sorted alphabetically. | ||
|
||
sortOrderFile | ||
User property: sort.sortOrderFile | ||
Custom sort order file. | ||
|
||
sortPlugins | ||
User property: sort.sortPlugins | ||
Comma-separated ordered list how plugins should be sorted. Example: | ||
groupId,artifactId The list can be separated by ',;:' | ||
|
||
sortProperties (Default: false) | ||
User property: sort.sortProperties | ||
Should the Maven pom properties be sorted alphabetically. Affects both | ||
project/properties and project/profiles/profile/properties | ||
|
||
sortpom:verify | ||
Description: Verifies that the pom.xml is sorted. If the verification fails | ||
then the pom.xml is sorted. | ||
Implementation: sortpom.VerifyMojo | ||
Language: java | ||
Bound to phase: validate | ||
|
||
Available parameters: | ||
|
||
backupFileExtension (Default: .bak) | ||
User property: sort.backupFileExtension | ||
Name of the file extension for the backup file. | ||
|
||
createBackupFile (Default: true) | ||
User property: sort.createBackupFile | ||
Should a backup copy be created for the sorted pom. | ||
|
||
encoding (Default: UTF-8) | ||
User property: sort.encoding | ||
Encoding for the files. | ||
|
||
expandEmptyElements (Default: true) | ||
User property: sort.expandEmptyElements | ||
Should empty xml elements be expanded or not. Example: | ||
<configuration></configuration> or <configuration/> | ||
|
||
indentBlankLines (Default: false) | ||
User property: sort.indentBlankLines | ||
Should blank lines (if preserved) have indentation. | ||
|
||
keepBlankLines (Default: false) | ||
User property: sort.keepBlankLines | ||
Should blank lines in the pom-file be preserved. A maximum of one line is | ||
preserved between each tag. | ||
|
||
lineSeparator (Default: ${line.separator}) | ||
User property: sort.lineSeparator | ||
Line separator for sorted pom. Can be either \n, \r or \r\n | ||
|
||
nrOfIndentSpace (Default: 2) | ||
User property: sort.nrOfIndentSpace | ||
Number of space characters to use as indentation. A value of -1 indicates | ||
that tab character should be used instead. | ||
|
||
pomFile (Default: ${project.file}) | ||
User property: sort.pomFile | ||
This is the File instance that refers to the location of the pom that | ||
should be sorted. | ||
|
||
predefinedSortOrder | ||
User property: sort.predefinedSortOrder | ||
Choose between a number of predefined sort order files. | ||
|
||
skip (Default: false) | ||
User property: sort.skip | ||
Set this to 'true' to bypass sortpom plugin | ||
|
||
sortDependencies | ||
User property: sort.sortDependencies | ||
Comma-separated ordered list how dependencies should be sorted. Example: | ||
scope,groupId,artifactId. If scope is specified in the list then the | ||
scope ranking is COMPILE, PROVIDED, SYSTEM, RUNTIME, IMPORT and TEST. The | ||
list can be separated by ',;:' | ||
|
||
sortModules (Default: false) | ||
User property: sort.sortModules | ||
Should the Maven pom sub modules be sorted alphabetically. | ||
|
||
sortOrderFile | ||
User property: sort.sortOrderFile | ||
Custom sort order file. | ||
|
||
sortPlugins | ||
User property: sort.sortPlugins | ||
Comma-separated ordered list how plugins should be sorted. Example: | ||
groupId,artifactId The list can be separated by ',;:' | ||
|
||
sortProperties (Default: false) | ||
User property: sort.sortProperties | ||
Should the Maven pom properties be sorted alphabetically. Affects both | ||
project/properties and project/profiles/profile/properties | ||
|
||
verifyFail (Default: sort) | ||
User property: sort.verifyFail | ||
What should happen if verification fails. Can be either 'sort', 'warn' or | ||
'stop' | ||
|
||
violationFilename | ||
User property: sort.violationFilename | ||
Saves the verification failure to an external xml file, recommended | ||
filename is 'target/sortpom_reports/violation.xml'. | ||
|
||
|
||
[INFO] ------------------------------------------------------------------------ | ||
[INFO] BUILD SUCCESS | ||
[INFO] ------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.goals=help:describe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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/maven-v4_0_0.xsd"> | ||
<name>SortPom Plugin :: ITs :: Default configuration</name> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>default-configuration</artifactId> | ||
<groupId>com.github.ekryd.sortpom.its</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<description>Test default parameters of the plugin</description> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-help-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<groupId>com.github.ekryd.sortpom</groupId> | ||
<artifactId>sortpom-maven-plugin</artifactId> | ||
<version>@pom.version@</version> | ||
<detail>true</detail> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
log = new File(basedir, 'build.log') | ||
expected_log = new File(basedir, 'expected.log') | ||
|
||
assert log.exists() | ||
assert log.text.contains(expected_log.text.replaceAll('@pom.version@', projectversion)) | ||
|
||
return true |
Oops, something went wrong.