Skip to content

Commit

Permalink
[MNG-5102] Add support for POM mixins
Browse files Browse the repository at this point in the history
# Conflicts:
#	core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
  • Loading branch information
gnodet committed Sep 14, 2023
1 parent 37b9369 commit af3ce31
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.
*/
package org.apache.maven.it;

import java.io.File;

import org.apache.maven.shared.verifier.Verifier;
import org.apache.maven.shared.verifier.util.ResourceExtractor;
import org.junit.jupiter.api.Test;

/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-5135">MNG-5135</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng5102MixinsTest extends AbstractMavenIntegrationTestCase {

public MavenITmng5102MixinsTest() {
super("(4.0.0-alpha-7,)");
}

/**
* Verify that mixins can be loaded from the file system.
*
* @throws Exception in case of failure
*/
@Test
public void testWithPath() throws Exception {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5102-mixins/path");

Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng5102");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();
}

/**
* Verify that mixins can be loaded from the repositories.
*
* @throws Exception in case of failure
*/
@Test
public void testWithGav() throws Exception {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5102-mixins/gav");

Verifier verifier = newVerifier(new File(testDir, "mixin-2").getAbsolutePath());

verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng5102");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();

verifier = newVerifier(new File(testDir, "project").getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public TestSuiteOrdering() {
* the tests are to finishing. Newer tests are also more likely to fail, so this is
* a fail fast technique as well.
*/
suite.addTestSuite(MavenITmng5102MixinsTest.class);
suite.addTestSuite(MavenITmng6401ProxyPortInterpolationTest.class);
suite.addTestSuite(MavenITmng7228LeakyModelTest.class);
suite.addTestSuite(MavenITmng7819FileLockingWithSnapshotsTest.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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.1.0" root="true">
<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>mixin-2</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<properties>
<mixin2>true</mixin2>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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.1.0" root="true">
<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>gav</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<name>Maven Integration Test :: MNG-5102</name>
<description>Mixins tests.</description>

<mixins>
<mixin>
<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>mixin-2</artifactId>
<version>0.1</version>
</mixin>
</mixins>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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>
<modelVersion>4.1.0</modelVersion>

<parent>
<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>path</artifactId>
</parent>

<artifactId>child</artifactId>
<packaging>jar</packaging>

<name>Maven Integration Test :: MNG-5102 :: Child</name>
<description>Mixins tests.</description>

<mixins>
<mixin>
<relativePath>../mixins/mixin-3.xml</relativePath>
</mixin>
</mixins>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>mixin-1</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<properties>
<mixin1>true</mixin1>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>mixin-3</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<properties>
<mixin3>true</mixin3>
</properties>
</project>
40 changes: 40 additions & 0 deletions core-it-suite/src/test/resources/mng-5102-mixins/path/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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 root="true">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.its.mng5102</groupId>
<artifactId>path</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<name>Maven Integration Test :: MNG-5102</name>
<description>Mixins tests.</description>

<modules>
<module>child</module>
</modules>

<mixins>
<mixin>
<relativePath>mixins/mixin-1.xml</relativePath>
</mixin>
</mixins>
</project>

0 comments on commit af3ce31

Please sign in to comment.