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

Deprecated method of commons-lang #1378

Open
yadavhitesh309 opened this issue Jan 24, 2025 · 3 comments
Open

Deprecated method of commons-lang #1378

yadavhitesh309 opened this issue Jan 24, 2025 · 3 comments

Comments

@yadavhitesh309
Copy link

Hi,

While running mutation test getting below error. It seems like due deprecated method usage in pitest. I am using 3.17.0 version of commons-lang3.

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution pit-test of goal org.pitest:pitest-maven:1.17.4:mutationCoverage failed: An API incompatibility was encountered while executing org.pitest:pitest-maven:1.17.4:mutationCoverage: java.lang.NoSuchMethodError: 'org.apache.commons.lang3.Range org.apache.commons.lang3.Range.of(java.lang.Comparable, java.lang.Comparable)'

@hcoles
Copy link
Owner

hcoles commented Jan 24, 2025

Can you share you pom file? Pitest doesn't share its classpath with the code under test (except for within child processes where a minimal number of dependencies exist, all of which are meant to be shaded), so library version mismatches shouldn't happen.

@yadavhitesh309
Copy link
Author

Please find below. However its working fine with version 1.17.0

0.95 0.83 2.16.1 ${jackson.core.version} 5.10.0 1.10.0 1.11.311 4.30.0 5.2.0 2.23.1 3.1.0 95 85 1.17.0 1.2.1 17 17 org.liquibase liquibase-core ${org.liquibase.version} test org.glassfish.jersey.inject jersey-hk2 ${jersey.version} org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-grizzly2 ${jersey.version} test org.glassfish.jersey.test-framework.providers jersey-test-framework-core ${jersey.version} test org.glassfish.jersey jersey-bom ${jersey.version} pom import org.glassfish.jersey.ext jersey-bean-validation ${jersey.version} javax javaee-api 7.0 org.postgresql postgresql 42.7.3 com.amazonaws aws-java-sdk-bom ${aws-sdk.version} pom import jakarta.ws.rs jakarta.ws.rs-api ${jakarta.version} compile org.yaml snakeyaml 2.0 org.apache.commons commons-lang3 3.17.0 com.github.ben-manes.caffeine caffeine 3.1.8 com.squareup.okhttp3 okhttp 4.12.0 com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson.core.version} com.fasterxml.jackson.core jackson-databind ${jackson.databind.version} com.google.code.gson gson 2.9.0 org.apache.logging.log4j log4j-api ${log4j.version} org.apache.logging.log4j log4j-core ${log4j.version} org.apache.logging.log4j log4j-slf4j-impl ${log4j.version} org.junit.jupiter junit-jupiter ${junit5.version} test org.junit.platform junit-platform-commons ${junit5.platform.commons.version} test org.junit.jupiter junit-jupiter-params ${junit5.version} test org.mockito mockito-core ${mockito.version} test org.mockito mockito-junit-jupiter ${mockito.version} test org.mockito mockito-inline ${mockito.version} test org.projectlombok lombok 1.18.28 provided com.fasterxml.jackson.core jackson-core ${jackson.core.version} compile org.jsoup jsoup 1.16.1 org.liquibase liquibase-core ${org.liquibase.version} test org.glassfish.jersey.test-framework jersey-test-framework-core ${jersey.version} test org.glassfish.jersey.inject jersey-hk2 ${jersey.version}
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.13.0</version>
    <configuration>
      <release>17</release>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.3.0</version>
  </plugin>
  <plugin>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.11.0.3922</version>
  </plugin>
  <plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <configuration>
      <excludes>
        
      </excludes>
    </configuration>
    <version>0.8.12</version>
    <executions>
      <execution>
        <id>prepare-agent</id>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
      </execution>
      <execution>
        <id>coverage-report</id>
        <phase>test</phase>
        <goals>
          <goal>report</goal>
        </goals>
      </execution>
      <execution>
        <id>jacoco-check</id>
        <goals>
          <goal>check</goal>
        </goals>
        <configuration>
          <rules>
            <rule>
              <element>BUNDLE</element>
              <limits>
                <limit>
                  <counter>LINE</counter>
                  <value>COVEREDRATIO</value>
                  <minimum>${code.coverage.line}</minimum>
                </limit>
              </limits>
              <limits>
                <limit>
                  <counter>BRANCH</counter>
                  <value>COVEREDRATIO</value>
                  <minimum>${code.coverage.branch}</minimum>
                </limit>
              </limits>
            </rule>
          </rules>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>
skipIntegrationTests org.apache.maven.plugins maven-surefire-plugin **/*DaoTest.java skipUnitTests org.apache.maven.plugins maven-surefire-plugin **/*DaoTest.java
<profile>
  <id>mutationTest</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>${pit-maven-version}</version>
        <dependencies>
          <dependency>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-junit5-plugin</artifactId>
            <version>${pitest-junit5-version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>pit-test</id>
            <phase>test-compile</phase>
            <goals>
              <goal>mutationCoverage</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <targetClasses>
            <param>com.app1.zdf.*</param>
          </targetClasses>
          <targetTests>
            <param>com.app1.zdf.*</param>
          </targetTests>
          <excludedClasses>
          </excludedClasses>
          <avoidCallsTo>

          </avoidCallsTo>
          <failWhenNoMutations>false</failWhenNoMutations>
          <exportLineCoverage>true</exportLineCoverage>
          <timestampedReports>false</timestampedReports>
          <historyInputFile>${project.basedir}/mutation-history/pitest.history
          </historyInputFile>
          <historyOutputFile>${project.basedir}/mutation-history/pitest.history
          </historyOutputFile>
          <mutationThreshold>${mutation-coverage-threshold}</mutationThreshold>
          <coverageThreshold>${pitest-code-coverage-threshold}</coverageThreshold>
          <mutators>
            <mutator>DEFAULTS</mutator>
          </mutators>
          <outputFormats>
            <value>XML</value>
            <value>HTML</value>
          </outputFormats>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>

@hcoles
Copy link
Owner

hcoles commented Jan 24, 2025

The reason you are seeing this with 1.17.4 is an upgrade to commons-text 1.12.0 in pitest entry, however the classpath of the maven plugin should be seperate from the classpath of your codebase. From the snippets of pom you have pasted it is unclear why there is a conflict.

Could you post a minimal project that recreates the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants