-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from peterlynch/pom-project-org
POM Project Organization properties
- Loading branch information
Showing
9 changed files
with
139 additions
and
0 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 @@ | ||
invoker.goals = license:format |
11 changes: 11 additions & 0 deletions
11
license-maven-plugin/src/it/pom-properties/mock-license.txt
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,11 @@ | ||
Mock license | ||
${project.groupId} | ||
${project.artifactId} | ||
${project.version} | ||
${project.name} | ||
${project.description} | ||
${project.inceptionYear} | ||
${project.url} | ||
${project.organization.name} | ||
${project.organization.url} | ||
ends here |
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,39 @@ | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.mycila.license-maven-plugin.it</groupId> | ||
<artifactId>pom-properties</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<name>Format using pom properties</name> | ||
<description>Integration Test for checking pom property replacement</description> | ||
<url>https://it.example.org</url> | ||
<inceptionYear>2008</inceptionYear> | ||
<organization> | ||
<name>Example, Inc.</name> | ||
<url>https://example.com</url> | ||
</organization> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.mycila</groupId> | ||
<artifactId>license-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<configuration> | ||
<header>mock-license.txt</header> | ||
<excludes> | ||
<exclude>invoker.properties</exclude> | ||
<exclude>pom.xml</exclude> | ||
<exclude>*.groovy</exclude> | ||
<exclude>**/*.expected</exclude> | ||
<exclude>*.log</exclude> | ||
</excludes> | ||
</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,23 @@ | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
|
||
final Path base = basedir.toPath() | ||
|
||
if (!Files.exists(base) || !Files.isDirectory(base)) { | ||
System.err.println("base directory is missing.") | ||
return false | ||
} | ||
|
||
final Path expectedJavaFile = base.resolve("src/main/java/com/mycilla/it/Unformatted1.java.expected") | ||
if (!Files.exists(expectedJavaFile)) { | ||
System.err.println("Unformatted1.java.expected file is missing.") | ||
return false | ||
} | ||
|
||
final Path unformattedJavaFile = base.resolve("src/main/java/com/mycilla/it/Unformatted1.java") | ||
if (!Files.exists(unformattedJavaFile)) { | ||
System.err.println("Unformatted1.java file is missing.") | ||
return false | ||
} | ||
|
||
return true; |
4 changes: 4 additions & 0 deletions
4
license-maven-plugin/src/it/pom-properties/src/main/java/com/mycilla/it/Unformatted1.java
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,4 @@ | ||
package com.mycila.it; | ||
|
||
public class Unformatted1 { | ||
} |
17 changes: 17 additions & 0 deletions
17
...aven-plugin/src/it/pom-properties/src/main/java/com/mycilla/it/Unformatted1.java.expected
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,17 @@ | ||
/* | ||
* Mock license | ||
* com.mycila.license-maven-plugin.it | ||
* pom-properties | ||
* 1.0.0 | ||
* Format using pom properties | ||
* Integration Test for checking pom property replacement | ||
* 2008 | ||
* https://it.example.org | ||
* Example, Inc. | ||
* https://example.com | ||
* ends here | ||
*/ | ||
package com.mycila.it; | ||
|
||
public class Unformatted1 { | ||
} |
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,36 @@ | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
|
||
import static org.junit.Assert.* | ||
|
||
|
||
final Path base = basedir.toPath() | ||
|
||
if (!Files.exists(base) || !Files.isDirectory(base)) { | ||
System.err.println("base directory is missing.") | ||
return false | ||
} | ||
|
||
final Path license = base.resolve("mock-license.txt") | ||
if (!Files.exists(license)) { | ||
System.err.println("license file is missing.") | ||
return false | ||
} | ||
|
||
final Path expectedJavaFile = base.resolve("src/main/java/com/mycilla/it/Unformatted1.java.expected") | ||
if (!Files.exists(expectedJavaFile)) { | ||
System.err.println(expectedJavaFile.getFileName() + " file is missing.") | ||
return false | ||
} | ||
|
||
final Path formattedJavaFile = base.resolve("src/main/java/com/mycilla/it/Unformatted1.java") | ||
if (!Files.exists(formattedJavaFile)) { | ||
System.err.println(formattedJavaFile.getFileName() + " file is missing.") | ||
return false | ||
} | ||
final String expected = new String(Files.readAllBytes(expectedJavaFile)) | ||
final String actual = new String(Files.readAllBytes(formattedJavaFile)) | ||
|
||
assertEquals(expected, actual) | ||
|
||
return true |
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