forked from mojohaus/build-helper-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it possible to configure port names using external resources
Url could be - regular file on file system - any file within classpath Resource file should be in plain text format with `new line` character as separator. Lines starting with `#` considered commented and therefore are ignored. Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
- Loading branch information
Showing
7 changed files
with
288 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
invoker.goals = test | ||
invoker.buildResult = success |
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 @@ | ||
# Port names | ||
port1 | ||
port2 | ||
port3 |
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 @@ | ||
# Port names | ||
port4 | ||
port5 | ||
port6 |
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,79 @@ | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin-reverse-port-it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>build-helper-maven-plugin-reverse-port-it</name> | ||
|
||
<build> | ||
<defaultGoal>package</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>reserve-ports</id> | ||
<phase>process-test-resources</phase> | ||
<goals> | ||
<goal>reserve-network-port</goal> | ||
</goals> | ||
<configuration> | ||
<urls> | ||
<url>file://${project.basedir}/names2.txt</url> | ||
</urls> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>reserve-ports-to-files</id> | ||
<phase>process-test-resources</phase> | ||
<goals> | ||
<goal>reserve-network-port</goal> | ||
</goals> | ||
<configuration> | ||
<outputFile>${project.build.directory}/ports.properties</outputFile> | ||
<urls> | ||
<url>file://${project.basedir}/names1.txt</url> | ||
<url>file://${project.basedir}/names2.txt</url> | ||
</urls> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>mk-target-dir</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<mkdir dir="${project.build.directory}" /> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
|
||
<execution> | ||
<id>echo-reserve-ports</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<echo>port1=${port1}</echo> | ||
<echo>port2=${port2}</echo> | ||
<echo>port3=${port3}</echo> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</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,10 @@ | ||
File file = new File( basedir, "build.log" ); | ||
assert file.exists(); | ||
|
||
String text = file.getText("utf-8"); | ||
|
||
assert text.contains("port1=") | ||
assert text.contains("port2=") | ||
assert text.contains("port3=") | ||
|
||
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
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