Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/it/MWAR-389/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

invoker.goals=clean install
54 changes: 54 additions & 0 deletions src/it/MWAR-389/main-war/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<parent>
<groupId>test</groupId>
<artifactId>MWAR-389</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>main-war</artifactId>
<packaging>war</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>@plexusUtilVersion@</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>test</groupId>
<artifactId>overlay-war</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
24 changes: 24 additions & 0 deletions src/it/MWAR-389/main-war/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
</web-app>
38 changes: 38 additions & 0 deletions src/it/MWAR-389/overlay-war/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<parent>
<groupId>test</groupId>
<artifactId>MWAR-389</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>overlay-war</artifactId>
<packaging>war</packaging>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</project>
24 changes: 24 additions & 0 deletions src/it/MWAR-389/overlay-war/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
</web-app>
42 changes: 42 additions & 0 deletions src/it/MWAR-389/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>test</groupId>
<artifactId>MWAR-389</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>MWAR-389 dependencyManagement overlay dependency version conflict</name>
<modules>
<module>overlay-war</module>
<module>main-war</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>@pom.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
136 changes: 136 additions & 0 deletions src/it/MWAR-389/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.io.*;
import org.codehaus.plexus.util.*;

/*
* Test for MWAR-220 / issue #389:
* dependencyManagement with overlays should not result in multiple versions
* of the same dependency in WEB-INF/lib.
*
* The overlay-war is built with plexus-utils 3.0.24.
* The main-war has dependencyManagement pinning plexus-utils to the managed
* version (@plexusUtilVersion@), and uses overlay-war as an overlay.
*
* If the issue still exists, both versions will appear in main-war's WEB-INF/lib.
* If fixed, only the managed version will appear.
*/

String managedVersion = plexusUtilVersion;

// --- Check overlay WAR content ---
File overlayTarget = new File( basedir, "overlay-war/target" );
File overlayWar = new File( overlayTarget, "overlay-war-1.0-SNAPSHOT" );
File overlayLib = new File( overlayWar, "WEB-INF/lib" );

if ( !overlayLib.exists() || !overlayLib.isDirectory() )
{
System.err.println( "Overlay WAR WEB-INF/lib directory missing: " + overlayLib );
return false;
}

String[] overlayJars = overlayLib.list();
if ( overlayJars == null )
{
System.err.println( "Failed to list overlay WAR WEB-INF/lib contents: " + overlayLib );
return false;
}
boolean overlayHasOld = false;
boolean overlayHasManaged = false;

for ( int i = 0; i < overlayJars.length; i++ )
{
String jar = overlayJars[i];
if ( jar.startsWith( "plexus-utils-3.0.24" ) )
{
overlayHasOld = true;
}
if ( jar.startsWith( "plexus-utils-" + managedVersion ) )
{
overlayHasManaged = true;
}
}

if ( !overlayHasOld )
{
System.err.println( "Overlay WAR missing plexus-utils-3.0.24.jar in WEB-INF/lib." );
return false;
}

if ( overlayHasManaged )
{
System.err.println( "Overlay WAR unexpectedly contains plexus-utils-" + managedVersion + ".jar. "
+ "Overlay should only have version 3.0.24." );
return false;
}

// Overlay WAR correctly contains only plexus-utils-3.0.24.jar.

// --- Check main WAR content ---
File mainTarget = new File( basedir, "main-war/target" );
File mainWar = new File( mainTarget, "main-war-1.0-SNAPSHOT" );
File mainLib = new File( mainWar, "WEB-INF/lib" );

if ( !mainLib.exists() || !mainLib.isDirectory() )
{
System.err.println( "Main WAR WEB-INF/lib directory missing: " + mainLib );
return false;
}

String[] mainJars = mainLib.list();
if ( mainJars == null )
{
System.err.println( "Failed to list main WAR WEB-INF/lib contents: " + mainLib );
return false;
}
boolean mainHasOld = false;
boolean mainHasManaged = false;

for ( int i = 0; i < mainJars.length; i++ )
{
String jar = mainJars[i];
if ( jar.startsWith( "plexus-utils-3.0.24" ) )
{
mainHasOld = true;
}
if ( jar.startsWith( "plexus-utils-" + managedVersion ) )
{
mainHasManaged = true;
}
}

if ( !mainHasManaged )
{
System.err.println( "Main WAR missing plexus-utils-" + managedVersion + ".jar in WEB-INF/lib." );
return false;
}

if ( mainHasOld )
{
// Both versions found -- issue STILL EXISTS
System.err.println( "Found plexus-utils-3.0.24.jar in main WAR WEB-INF/lib; "
+ "dependencyManagement should have excluded it." );
return false;
}
else
{
// Only managed version -- issue has been fixed
return true;
}
Loading
Loading