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

[SUREFIRE-1972] Use current version of surefire-shared-utils #443

Merged
merged 2 commits into from
Jan 18, 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
8 changes: 6 additions & 2 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ jobs:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2
with:
ff-goal: 'install'
verify-goal: 'install -P run-its'
ff-goal: 'clean install -nsu -P run-its'
ff-site-goal: 'clean install site -nsu -DskipTests -P reporting'
verify-goal: 'clean install -nsu -P run-its'
verify-site-goal: 'clean install site -nsu -DskipTests -P reporting'
verify-fail-fast: false
failure-upload-path: |
surefire-its/target/*/log.txt
surefire-its/target/**/surefire-reports/*
surefire-its/target/**/failsafe-reports/*
max-parallel: 4
timeout-minutes: 420
2 changes: 1 addition & 1 deletion maven-failsafe-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@
<postBuildHookScript>verify</postBuildHookScript>
<settingsFile>src/it/settings.xml</settingsFile>
<skipInvocation>${skipTests}</skipInvocation>
<streamLogs>true</streamLogs>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we changing this line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the info logs do not help. And debug logs cannot be read in the main logs.
Several days ago we fixed logs archives and so these logs of this module can be downloaded as a zip.

<showErrors>true</showErrors>
<properties>
<integration-test-port>${failsafe-integration-test-port}</integration-test-port>
<integration-test-stop-port>${failsafe-integration-test-stop-port}</integration-test-stop-port>
</properties>
<debug>true</debug>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I need to have debug logs if I investigate a problem. For instance failures of downloading artifacts of plugin parameters, etc.

</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion maven-surefire-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>3.0.0-M4</version>
<version>${surefire-shared-utils.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</contributors>

<modules>
<module>surefire-shared-utils</module>
<module>surefire-logger-api</module>
<module>surefire-api</module>
<module>surefire-extensions-api</module>
Expand All @@ -62,7 +63,6 @@
<module>maven-failsafe-plugin</module>
<module>maven-surefire-report-plugin</module>
<module>surefire-its</module>
<module>surefire-shared-utils</module>
</modules>

<scm>
Expand Down Expand Up @@ -101,6 +101,7 @@
<powermockVersion>2.0.9</powermockVersion>
<mavenPluginToolsVersion>3.6.2</mavenPluginToolsVersion>
<jacocoVersion>0.8.7</jacocoVersion>
<surefire-shared-utils.version>${project.version}</surefire-shared-utils.version>
<maven.surefire.scm.devConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-surefire.git</maven.surefire.scm.devConnection>
<maven.site.path>surefire-archives/surefire-LATEST</maven.site.path>
<maven.compiler.testSource>1.${javaVersion}</maven.compiler.testSource>
Expand Down Expand Up @@ -687,7 +688,17 @@
</reporting>

<profiles>

<profile>
<!-- First, install the project without tests -> mvn install -DskipTests
This is a workaround for IntelliJ IDEA, see https://youtrack.jetbrains.com/issue/IDEA-148573
IDEA is able to recognize external artifacts with classifiers. But IDEA expects modules and their artifacts
without classifier. If the version differs from project, the idea would understand it as external artifact.
-->
<id>ide-development</id>
<properties>
<surefire-shared-utils.version>3-SNAPSHOT</surefire-shared-utils.version>
</properties>
</profile>
Comment on lines +691 to +701
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that nobody will not install project with special profile ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slawekjaranowski
Slawomir, we were talking about it in previous PR. There is no other way. I was explaining it that the IDE and Maven work different way, the Maven understands shading and attaching artifacts but the IDEs don't and that's the reason why it has to be like this. We don't live in ideal world but we cannot wait forever until Jetbrain would fix the issue. If the developers does not care about red line, okay, but I don't because I do not want to have red lines in the code and also I do not want to copy paste the source code from external libraries because it is not maintainable way. So this is the explanation. Regarding the version 3-SNAPSHOT, it can be anything, that's only cosmetic issue.

<profile>
<id>jdk9+</id>
<activation>
Expand All @@ -697,7 +708,6 @@
<jvm9ArgsTests>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED --add-opens java.base/sun.nio.cs=ALL-UNNAMED --add-opens java.base/java.nio.file=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED</jvm9ArgsTests>
</properties>
</profile>

<profile>
<id>reporting</id>
<reporting>
Expand Down
2 changes: 1 addition & 1 deletion surefire-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>3.0.0-M4</version>
<version>${surefire-shared-utils.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down
3 changes: 2 additions & 1 deletion surefire-booter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using this older version "3.0.0-M3" ? what's the reasoning about choosing this one ? could it be 2.x ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try with 2.22.2. Let's see what happens...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eolivelli
I have used the 2.22.2 but it gives me bad result
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Sorry!

<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shadefire</artifactId>
<version>3.0.0-M4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
<version>3.0.0-M3</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
</dependency>
</dependencies>
<configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
public class NewClassLoaderRunner
extends BlockJUnit4ClassRunner
{
private static final String PROJECT_DIR = System.getProperty( "java.dir" );

private Class<?> cls;

public NewClassLoaderRunner( Class<?> clazz )
Expand Down Expand Up @@ -236,17 +238,14 @@ private static Collection<URL> toPathList()
Collection<URL> classPath = new HashSet<>();
try
{
String[] files = FileUtils.fileRead( new File( "target/test-classpath/cp.txt" ), "UTF-8" )
.split( pathSeparator );
File classPathFile = new File( PROJECT_DIR, "target/test-classpath/cp.txt" );
String[] files = FileUtils.fileRead( classPathFile, "UTF-8" ).split( pathSeparator );
for ( String file : files )
{
File f = new File( file );
File dir = f.getParentFile();
classPath.add(
( dir.getName().equals( "target" ) ? new File( dir, "classes" ) : f ).toURI().toURL() );
classPath.add( new File( file ).toURI().toURL() );
}
classPath.add( new File( "target/classes" ).toURI().toURL() );
classPath.add( new File( "target/test-classes" ).toURI().toURL() );
classPath.add( new File( PROJECT_DIR, "target/classes" ).toURI().toURL() );
classPath.add( new File( PROJECT_DIR, "target/test-classes" ).toURI().toURL() );
}
catch ( IOException e )
{
Expand Down
2 changes: 1 addition & 1 deletion surefire-extensions-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>3.0.0-M4</version>
<version>${surefire-shared-utils.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-report-parser</artifactId>
<version>${project.version}</version>
<version>3.0.0-M5</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion surefire-providers/common-java5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>3.0.0-M4</version>
<version>${surefire-shared-utils.version}</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion surefire-report-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>3.0.0-M4</version>
<version>${surefire-shared-utils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
Expand Down
36 changes: 34 additions & 2 deletions surefire-shared-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

<artifactId>surefire-shared-utils</artifactId>
<name>Surefire Shared Utils</name>
<description>Relocated Java packages of maven-shared-utils in Surefire</description>
<description>
Relocated Java packages of maven-shared-utils and several Apache Commons utilities in Surefire.
</description>

<licenses>
<license>
Expand Down Expand Up @@ -100,5 +102,35 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<!-- First, install the project without tests -> mvn install -DskipTests
This is a workaround for IntelliJ IDEA, see https://youtrack.jetbrains.com/issue/IDEA-148573
IDEA is able to recognize external artifacts with classifiers. But IDEA expects modules and their artifacts
without classifier. If the version differs from project, the idea would understand it as external artifact.
-->
<id>ide-development</id>
<build>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-devel-jar</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<artifactId>surefire-shared-utils</artifactId>
<version>3-SNAPSHOT</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 3-SNAPSHOT ? is this a random name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this version is not used in deployment or elsewhere. Basically the number also does not matter ;-)
The only reason why this section is here is the fact that Intellij IDEA and maybe Eclipse too, is not able to work with Shaded Jar in module surefire-shared-utils. So the IDEA is not able to load the shaded jar even if Maven attached it to the POM. So this is only the trick that we can enable this profile ide-development and identical Jar is loaded by IDEA from local repo and then we do not have the red lines in the code. Of course Maven build does not need it because Maven can work with shaded and attached Jar. But IDEA has this problem, pity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eoliveli I can change this number. Let me know pls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that nobody will not install project with special profile ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slawekjaranowski
I spoke about it with @miachael-o , it is not Maven problem. The IDEA is an open source project and can be fixed, see the ticket. These are two separate issues and they are in progress..

<file>target/${project.build.finalName}.jar</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>