Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSHARED-1035] Get rid of maven-plugin-testing-tools for IT test #50

Merged
merged 1 commit into from
Feb 17, 2022
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2
with:
# remove after MSHARED-916
maven_version: '3.6.3'
89 changes: 28 additions & 61 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@
<project.build.outputTimestamp>2022-01-24T19:57:26Z</project.build.outputTimestamp>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
Expand Down Expand Up @@ -112,12 +102,8 @@
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-tools</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>

<!-- testing support -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -145,37 +131,8 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<!-- remove after MSHARED-916 -->
<id>enforce-max-maven-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>(,3.6.3]</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<maven.home>${maven.home}</maven.home>
<local.repo>${project.build.directory}/local-repo</local.repo>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
Expand All @@ -192,24 +149,34 @@

<profiles>
<profile>
<id>maven-repo-local</id>
<activation>
<property>
<name>maven.repo.local</name>
</property>
</activation>
<id>run-its</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemProperties combine.children="append">
<property>
<!-- Pass this through to the tests (if set!) to have them pick the right repository -->
<name>maven.repo.local</name>
<value>${maven.repo.local}</value>
</property>
</systemProperties>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<localRepositoryPath>target/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<postBuildHookScript>verify</postBuildHookScript>
<goals>
<goal>verify</goal>
</goals>
<properties>
<maven.compiler.source>${java.specification.version}</maven.compiler.source>
<maven.compiler.target>${java.specification.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,22 @@
<version>1.6.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
<artifactId>maven-mock-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>mock-analyze</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
33 changes: 33 additions & 0 deletions src/it/inlinedStaticReference/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

def analysis = new File( basedir, 'target/analysis.txt' ).text

def expected = '''
UsedDeclaredArtifacts:
dom4j:dom4j:jar:1.6.1:compile

UsedUndeclaredArtifactsWithClasses:

UnusedDeclaredArtifacts:

TestArtifactsWithNonTestScope:
'''

assert analysis == expected
58 changes: 58 additions & 0 deletions src/it/jarWithClassInUnnamedPackage/project2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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.shared.dependency-analyzer.tests</groupId>
<artifactId>jarWithClassInUnnamedPackage2</artifactId>
<packaging>jar</packaging>
<version>1.0</version>

<dependencies>
<dependency>
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
<artifactId>jarWithClassInUnnamedPackage1</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
<artifactId>maven-mock-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>mock-analyze</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
33 changes: 33 additions & 0 deletions src/it/jarWithClassInUnnamedPackage/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

def analysis = new File( basedir, 'project2/target/analysis.txt' ).text

def expected = '''
UsedDeclaredArtifacts:

UsedUndeclaredArtifactsWithClasses:

UnusedDeclaredArtifacts:
org.apache.maven.shared.dependency-analyzer.tests:jarWithClassInUnnamedPackage1:jar:1.0:compile

TestArtifactsWithNonTestScope:
'''

assert analysis == expected
63 changes: 63 additions & 0 deletions src/it/jarWithCompileDependency/project2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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.shared.dependency-analyzer.tests</groupId>
<artifactId>jarWithCompileDependency2</artifactId>
<packaging>jar</packaging>
<version>1.0</version>

<dependencies>
<dependency>
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
<artifactId>jarWithCompileDependency1</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-android</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
<artifactId>maven-mock-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>mock-analyze</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
34 changes: 34 additions & 0 deletions src/it/jarWithCompileDependency/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/

def analysis = new File( basedir, 'project2/target/analysis.txt' ).text

def expected = '''
UsedDeclaredArtifacts:
org.apache.maven.shared.dependency-analyzer.tests:jarWithCompileDependency1:jar:1.0:compile
com.google.guava:guava:jar:30.1.1-android:compile

UsedUndeclaredArtifactsWithClasses:

UnusedDeclaredArtifacts:

TestArtifactsWithNonTestScope:
'''

assert analysis == expected
Loading