-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to resolve project.version in depdencendies section
This closes #129
- Loading branch information
1 parent
4fb439f
commit e0a9acd
Showing
11 changed files
with
448 additions
and
32 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
2 changes: 2 additions & 0 deletions
2
src/it/multi-pure-extension-resolve-version-variable-it/.gitignore
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 @@ | ||
prebuild.log | ||
build.log |
25 changes: 25 additions & 0 deletions
25
src/it/multi-pure-extension-resolve-version-variable-it/.mvn/extensions.xml
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,25 @@ | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd"> | ||
<extension> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
</extension> | ||
</extensions> |
49 changes: 49 additions & 0 deletions
49
src/it/multi-pure-extension-resolve-version-variable-it/module/pom.xml
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,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<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> | ||
|
||
<artifactId>multi-pure-extension-it-module</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it</artifactId> | ||
<version>0</version> | ||
</parent> | ||
|
||
<description>A simple IT verifying the basic use case.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<finalName>my-module-${project.version}</finalName> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
28 changes: 28 additions & 0 deletions
28
...xtension-resolve-version-variable-it/module/src/main/java/fr/brouillard/oss/demo/App.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,28 @@ | ||
/* | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package fr.brouillard.oss.demo; | ||
|
||
/** | ||
* Hello world! | ||
* | ||
*/ | ||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
System.out.println( "Hello World!" ); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/it/multi-pure-extension-resolve-version-variable-it/pom.xml
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,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<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>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it</artifactId> | ||
<version>0</version> | ||
<packaging>pom</packaging> | ||
|
||
<description>Resolve project.version variable in properties, dependencies and plugins.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<jgitver.resolve-project-version>true</jgitver.resolve-project-version> | ||
<calculated-project.version>${project.version}</calculated-project.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>module</module> | ||
<module>war</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it-module</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it-module</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it-module</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
48 changes: 48 additions & 0 deletions
48
src/it/multi-pure-extension-resolve-version-variable-it/prebuild.groovy
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,48 @@ | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
def log = new PrintWriter( new File(basedir, "prebuild.log").newWriter("UTF-8"), true ) | ||
log.println( "Prebuild started at: " + new Date() + " in: " + basedir ) | ||
|
||
[ | ||
"git --version", | ||
"git init", | ||
"git config user.name \"nobody\"", | ||
"git config user.email \"nobody@nowhere.com\"", | ||
"dd if=/dev/urandom of=content bs=512 count=2", | ||
"git add .", | ||
"git commit --message=initial_commit", | ||
"git tag -a 1.0.0 --message=release_1.0.0", | ||
"dd if=/dev/urandom of=content bs=512 count=2", | ||
"git add -u", | ||
"git commit --message=added_B_data", | ||
"git log --graph --oneline" | ||
].each{ command -> | ||
|
||
def proc = command.execute(null, basedir) | ||
def sout = new StringBuilder(), serr = new StringBuilder() | ||
proc.waitForProcessOutput(sout, serr) | ||
|
||
log.println( "cmd: " + command ) | ||
log.println( "out:" ) ; log.println( sout.toString().trim() ) | ||
log.println( "err:" ) ; log.println( serr.toString().trim() ) | ||
log.println( "ret: " + proc.exitValue() ) | ||
|
||
assert proc.exitValue() == 0 | ||
} | ||
|
||
log.println( "Prebuild completed at: " + new Date() ) | ||
log.close() | ||
return true |
46 changes: 46 additions & 0 deletions
46
src/it/multi-pure-extension-resolve-version-variable-it/verify.groovy
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,46 @@ | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
def baseDir = new File("$basedir") | ||
|
||
File actions = new File(baseDir, "verify-actions.log") | ||
actions.write 'Actions started at: ' + new Date() + '\n' | ||
|
||
actions << 'rm -rf .git'.execute(null, baseDir).text | ||
|
||
// Check the version was used by the plugin execution | ||
def foundLines = new File("$basedir", "build.log").readLines().findAll { it =~ /fr.brouillard.oss.it.resolve-project-version::multi-pure-extension-it::0 -> 1.0.1-SNAPSHOT/ } | ||
assert 0 < foundLines.size | ||
|
||
// And check that the produced artifact was installed with the good version | ||
File installedPomFile = new File("$basedir" + "/../../local-repo/fr/brouillard/oss/it/resolve-project-version/multi-pure-extension-it/1.0.1-SNAPSHOT/", "multi-pure-extension-it-1.0.1-SNAPSHOT.pom") | ||
assert installedPomFile.isFile() | ||
assert 4 == installedPomFile.readLines().findAll { it =~ /<version>1.0.1-SNAPSHOT<\/version>/ }.size() | ||
assert 1 == installedPomFile.readLines().findAll { it =~ /<calculated-project.version>1.0.1-SNAPSHOT<\/calculated-project.version>/ }.size() | ||
|
||
File installedJarPomFile = new File("$basedir" + "/../../local-repo/fr/brouillard/oss/it/resolve-project-version/multi-pure-extension-it-module/1.0.1-SNAPSHOT/", "multi-pure-extension-it-module-1.0.1-SNAPSHOT.pom") | ||
assert installedJarPomFile.isFile() | ||
assert 2 == installedJarPomFile.readLines().findAll { it =~ /<version>1.0.1-SNAPSHOT<\/version>/ }.size() | ||
|
||
File installedJarFile = new File("$basedir" + "/../../local-repo/fr/brouillard/oss/it/resolve-project-version/multi-pure-extension-it-module/1.0.1-SNAPSHOT/", "multi-pure-extension-it-module-1.0.1-SNAPSHOT.jar") | ||
assert installedJarFile.isFile() | ||
|
||
File installedWarPomFile = new File("$basedir" + "/../../local-repo/fr/brouillard/oss/it/resolve-project-version/multi-pure-extension-it-app/1.0.1-SNAPSHOT/", "multi-pure-extension-it-app-1.0.1-SNAPSHOT.pom") | ||
assert installedWarPomFile.isFile() | ||
assert 3 == installedWarPomFile.readLines().findAll { it =~ /<version>1.0.1-SNAPSHOT<\/version>/ }.size() | ||
|
||
File installedWarFile = new File("$basedir" + "/../../local-repo/fr/brouillard/oss/it/resolve-project-version/multi-pure-extension-it-app/1.0.1-SNAPSHOT/", "multi-pure-extension-it-app-1.0.1-SNAPSHOT.war") | ||
assert installedWarFile.isFile() | ||
return true |
60 changes: 60 additions & 0 deletions
60
src/it/multi-pure-extension-resolve-version-variable-it/war/pom.xml
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,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<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> | ||
|
||
<artifactId>multi-pure-extension-it-app</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<parent> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it</artifactId> | ||
<version>0</version> | ||
</parent> | ||
|
||
<description>A simple IT verifying the basic use case.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
||
<finalName>webapp</finalName> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>fr.brouillard.oss.it.resolve-project-version</groupId> | ||
<artifactId>multi-pure-extension-it-module</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.