Skip to content

Commit

Permalink
Issue release-engineering#319 Improve inheritance resolving when inje…
Browse files Browse the repository at this point in the history
…cting plugin pom
  • Loading branch information
rnc committed Mar 13, 2016
1 parent 9800d78 commit 038941e
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 35 deletions.
64 changes: 64 additions & 0 deletions integration-test/src/it/remote-plugin-management-wildfly/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2012 Red Hat, Inc. (jcasey@redhat.com)
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.commonjava.maven.ext</groupId>
<artifactId>remote-plugin-management-wildfly</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Test override plugin version using command line property</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>99-bad</version>
</plugin>
</plugins>
</pluginManagement>


<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>1000-bad</version>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (C) 2012 Red Hat, Inc. (jcasey@redhat.com)
*
* 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 test;

import org.junit.Test;

public class HelloWorldwithJUnit
{
public static void main (String [] args)
{
System.out.println("hello");
}

@Test
public void test()
{
// Just a dummy method to verify that we can compile again JUnit 4
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (C) 2012 Red Hat, Inc. (jcasey@redhat.com)
#
# 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.
#


# Override the version of maven compiler plugin
# The colon needs to be escaped to prevent the invoker plugin from misinterpreting it
pluginManagement=org.wildfly.core\:wildfly-core-parent\:2.0.10.Final
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (C) 2012 Red Hat, Inc. (jcasey@redhat.com)
*
* 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 pomFile = new File( basedir, 'pom.xml' )
System.out.println( "Slurping POM: ${pomFile.getAbsolutePath()}" )

def pom = new XmlSlurper().parse( pomFile )

def plugin = pom.build.pluginManagement.plugins.plugin.find { it.artifactId.text() == "maven-compiler-plugin" }
assert plugin != null
assert plugin.version.text() == "3.1"

def message = 0
pomFile.eachLine {
if (it.contains( "maven-jar-plugin")) {
message++
}
}

assert message == 1
14 changes: 14 additions & 0 deletions integration-test/src/it/setup/pluginMgmt1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<dependencies>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-core-parent</artifactId>
<version>2.0.10.Final</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
Expand Down
Loading

0 comments on commit 038941e

Please sign in to comment.