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

Preparing files without an MavenJupiterExtension tests causes MalformedInputException resulting in build fails #473

Open
Bukama opened this issue Jun 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Bukama
Copy link
Contributor

Bukama commented Jun 22, 2024

Describe the bug

Running a maven build with the extension configured but without any test results in MalformedInputException.

To Reproduce
Steps to reproduce the behavior:

In short:

  1. Take former working Maven project
  2. Add the default plugin configurations and dependencys as in the user guide of the MavenJupiterExtension
  3. Add some example projects under src/test/resources-its/
  4. Run mvn clean verify

In long

  1. Best is having a full working example project which shows the code/test. This makes it possible
    to reproduce your issue.

That's my current setup

apache/maven-pmd-plugin@5fae1f6

Description

I've started setting up the setup for using the MavenJupiterExtension on the Maven PMD plugin (to then trying to recreate a bug).

Following the user guide I've added the dependencies

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.10.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-jupiter-extension</artifactId>
      <version>0.13.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-assertj</artifactId>
      <version>0.13.1</version>
      <scope>test</scope>
    </dependency>

    <!-- added to run old Junit 4 tests -->
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>5.10.2</version>
      <scope>test</scope>
    </dependency>

and plugin configuration

      <!-- Maven IT Extention  by Karl-Heinz Marbaise (needs also surefire) -->
      <plugin>
        <groupId>com.soebes.itf.jupiter.extension</groupId>
        <artifactId>itf-maven-plugin</artifactId>
        <version>0.13.1</version>
        <executions>
          <execution>
            <id>installing</id>
            <goals>
              <goal>install</goal>
              <goal>resources-its</goal>
            </goals>
            <phase>pre-integration-test</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <systemPropertyVariables>
            <maven.version>${maven.version}</maven.version>
            <maven.home>${maven.home}</maven.home>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

and in my already prepared Maven projects for the tests under src/test/resources-its/MPMD-386/. They are all clear Maven projects, meaning no target folder (obviously).

I have not yet written a test!

When I now run a mvn clear verify to make sure that I have no typos in XML setup, dependecy violations etc the build breaks with the following message

[ERROR] Failed to execute goal com.soebes.itf.jupiter.extension:itf-maven-plugin:0.13.1:resources-its (installing) on project maven-pmd-plugin: filtering D:\Github\Maven\maven-pmd-plugin\src\test\resources-its\MPMD-386\3_14\MultiSubFolder\subfolder\moduleA\target\pmd\pmd.cache to D:\Github\Maven\maven-pmd-plugin\target\test-classes\MPMD-386\3_14\MultiSubFolder\subfolder\moduleA\target\pmd\pmd.cache failed with MalformedInputException: Input length = 1 -> [Help 1]

While I don't understand why the extension is trying to access files from the (second in folder) project it's quite clear that the MalformedInputException is thrown as there is no pmd folder inside the target folder of that project (which seems to be generated by the extension) and therefore no pmd.cache file.

Current behavior
Builds breaks with MalformedInputException

[ERROR] Failed to execute goal com.soebes.itf.jupiter.extension:itf-maven-plugin:0.13.1:resources-its (installing) on project maven-pmd-plugin: filtering D:\Github\Maven\maven-pmd-plugin\src\test\resources-its\MPMD-386\3_14\MultiSubFolder\subfolder\moduleA\target\pmd\pmd.cache to D:\Github\Maven\maven-pmd-plugin\target\test-classes\MPMD-386\3_14\MultiSubFolder\subfolder\moduleA\target\pmd\pmd.cache failed with MalformedInputException: Input length = 1 -> [Help 1]

Expected behavior
Build runs without problems as no IT has yet been created which could be picked up by the extension.

*Log files/Information

See To Reproduce

Full Working Example
To follow your issue it is really needed to have a full working example
of the behaviour which shows the problem otherwise it's really hard to
find the problem or even more to fix issues.

apache/maven-pmd-plugin@5fae1f6

The used versions
The version of tools you have used.

Maven home: C:\apache-maven-4.0.0-beta-3
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: C:\JDK\Java17
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "winnt"

IDE: command line
ITF: 0.13.1 (newest as time of writing)

@Bukama Bukama added the bug Something isn't working label Jun 22, 2024
@khmarbaise khmarbaise added this to the itf-extension-0.14.0 milestone Jul 23, 2024
@GiuseppeMP
Copy link

@Bukama I had this issue before and discovered that my IDE was building the test projects and creating a target folder inside them. I deleted the target folder from each project, and the error went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants