Skip to content

Commit

Permalink
[MPIR-455] dependencies goal: add support for multi-release JARs
Browse files Browse the repository at this point in the history
This closes #70
  • Loading branch information
belingueres authored and michael-o committed Jun 13, 2024
1 parent be2e4ed commit a44cc8a
Show file tree
Hide file tree
Showing 13 changed files with 420 additions and 11 deletions.
37 changes: 36 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ under the License.
<version>3.4.2</version>
<scope>test</scope>
</dependency>
<!--
TODO: Correct the JAR root content entries count workaround used
to generate dependencies section when MSHARED-1411 is fixed.
-->
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-jar</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
Expand Down Expand Up @@ -516,6 +520,37 @@ under the License.
</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<propertyName>repository.proxy.url</propertyName>
<repositories>
<mockRepo>
<source>src/it/mrm/repository</source>
<!--
force to replicate the mock repo with the *actual* jar files to
perform the analysis (MPIR-455)
-->
<cloneTo>${project.build.directory}/local-repo</cloneTo>
</mockRepo>
<!-- serve content installed by maven-invoker-plugin -->
<localRepo>
<source>${project.build.directory}/local-repo</source>
</localRepo>
<proxyRepo />
</repositories>
</configuration>
<executions>
<execution>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
20 changes: 20 additions & 0 deletions src/it/MPIR-455/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

# Remove with next major version
invoker.mavenOpts = -Duser.language=en
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:dependencies
87 changes: 87 additions & 0 deletions src/it/MPIR-455/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.plugins.project-info-reports.its</groupId>
<artifactId>MPIR-455</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<url>http://maven.apache.org/plugins/it/${project.artifactId}</url>

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

<dependencies>
<!-- an example of a dependency with a problematic POM -->
<dependency>
<groupId>org.apache.maven.its.mpir-455</groupId>
<artifactId>multi-release-test</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mpir-455</groupId>
<artifactId>module-info-only-test</artifactId>
<version>0.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
<report>dependencies</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

</project>
119 changes: 119 additions & 0 deletions src/it/MPIR-455/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* 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.
*/
String html = new File( basedir, 'target/site/dependencies.html' ).text.normalize()

def summaryLine = '''\
<tr class="b">
<td align="left">module-info-only-test-0.0.1.jar</td>
<td align="right">3.3 kB</td>
<td align="right">10</td>
<td align="right">-</td>
<td align="right">-</td>
<td align="center">-</td>
<td align="center">-</td></tr>
<tr class="a">
<td align="left">&#160;&#160;&#160;&#x2022; Root</td>
<td align="right">-</td>
<td align="right">9</td>
<td align="right">0</td>
<td align="right">0</td>
<td align="center">-</td>
<td align="center">-</td></tr>
<tr class="b">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">11</td>
<td align="center">No</td></tr>
<tr class="a">
<td align="left">multi-release-test-0.0.1.jar</td>
<td align="right">10.2 kB</td>
<td align="right">37</td>
<td align="right">-</td>
<td align="right">-</td>
<td align="center">-</td>
<td align="center">-</td></tr>
<tr class="b">
<td align="left">&#160;&#160;&#160;&#x2022; Root</td>
<td align="right">-</td>
<td align="right">19</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">1.8</td>
<td align="center">Yes</td></tr>
<tr class="a">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">9</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">9</td>
<td align="center">Yes</td></tr>
<tr class="b">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">9</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">11</td>
<td align="center">Yes</td></tr>
<tr class="a">
<td align="left">plexus-utils-4.0.0.jar</td>
<td align="right">192.4 kB</td>
<td align="right">128</td>
<td align="right">-</td>
<td align="right">-</td>
<td align="center">-</td>
<td align="center">-</td></tr>
<tr class="b">
<td align="left">&#160;&#160;&#160;&#x2022; Root</td>
<td align="right">-</td>
<td align="right">113</td>
<td align="right">86</td>
<td align="right">7</td>
<td align="center">1.8</td>
<td align="center">Yes</td></tr>
<tr class="a">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">5</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">9</td>
<td align="center">Yes</td></tr>
<tr class="b">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">5</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">10</td>
<td align="center">Yes</td></tr>
<tr class="a">
<td align="left">&#160;&#160;&#160;&#x2022; Versioned</td>
<td align="right">-</td>
<td align="right">5</td>
<td align="right">1</td>
<td align="right">1</td>
<td align="center">11</td>
<td align="center">Yes</td></tr>'''

assert html.contains( summaryLine.normalize() )
Binary file not shown.
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 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>org.apache.maven.its.mpir-455</groupId>
<artifactId>module-info-only-test</artifactId>
<version>0.0.1</version>

<name>module-info-only-test</name>
</project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.mpir-455</groupId>
<artifactId>multi-release-test</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>

<name>multi-release-test</name>

</project>
14 changes: 14 additions & 0 deletions src/it/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ under the License.
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>snapshots</id>
<url>@repository.proxy.url@</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
Expand Down
Loading

0 comments on commit a44cc8a

Please sign in to comment.