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

[WARNING] The POM for org.apache.jmeter:ApacheJMeter_http:jar:5.6.1 is invalid #6041

Closed
jloisel opened this issue Jul 11, 2023 · 14 comments · Fixed by #6042
Closed

[WARNING] The POM for org.apache.jmeter:ApacheJMeter_http:jar:5.6.1 is invalid #6041

jloisel opened this issue Jul 11, 2023 · 14 comments · Fixed by #6042
Labels
Milestone

Comments

@jloisel
Copy link

jloisel commented Jul 11, 2023

Expected behavior

When trying to depend on Apache JMeter http dependency:

[WARNING] The POM for org.apache.jmeter:ApacheJMeter_http:jar:5.6.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

java: package org.apache.jmeter.testelement does not exist

image

Actual behavior

No response

Steps to reproduce the problem

  <dependencies>
    <dependency>
      <groupId>org.apache.jmeter</groupId>
      <artifactId>ApacheJMeter_http</artifactId>
      <version>5.6.1</version>
    </dependency>
  </dependencies>

JMeter Version

5.6.1

Java Version

openjdk version "17.0.7" 2023-04-18

OS Version

Ubuntu 22.04 LTS

@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

[WARNING] The POM for org.apache.jmeter:ApacheJMeter_http:jar:5.6.1 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.apache.jmeter:ApacheJMeter_http:5.6.1
[ERROR] 'dependencies.dependency.version' for com.google.auto.service:auto-service-annotations:jar is missing. @

@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

Frankly speaking, I agree it might look confusing for a pom to miss <version>, however, a missing version is in line with XSD.
So I think it would make sense to follow-up with Maven developers, and request that Maven should not discard all the transitive dependencies once it faces a single one without a version.

@milamberspace
Copy link
Contributor

org.apache.jmeter.samplers.SampleListener is in ApacheJMeter_core not _http?

@milamberspace
Copy link
Contributor

milamberspace commented Jul 11, 2023

Works with this pom

<?xml version="1.0" encoding="UTF-8"?>
<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.example</groupId>
    <artifactId>TestBugMaven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.jmeter</groupId>
            <artifactId>ApacheJMeter_core</artifactId>
            <version>5.6.1</version>
        </dependency>
    </dependencies>
</project>

@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

@milamberspace , try running mvn dependency:tree with that pom. it will not show transitive dependencies.

[WARNING] The POM for org.apache.jmeter:ApacheJMeter_core:jar:5.6.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ TestBugMaven ---
[INFO] org.example:TestBugMaven:jar:1.0-SNAPSHOT
[INFO] \- org.apache.jmeter:ApacheJMeter_core:jar:5.6.1:compile

Then, if you patch ~/.m2/repository/org/apache/jmeter/ApacheJMeter_core/5.6.1 by adding <version>1.1.1</version> to auto-service-annotations, you'll get a dramatic difference:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ TestBugMaven ---
[INFO] org.example:TestBugMaven:jar:1.0-SNAPSHOT
[INFO] \- org.apache.jmeter:ApacheJMeter_core:jar:5.6.1:compile
[INFO]    +- org.apache.jmeter:ApacheJMeter:jar:5.6.1:compile
[INFO]    +- org.apache.jmeter:jorphan:jar:5.6.1:compile
[INFO]    +- bsf:bsf:jar:2.4.0:compile
[INFO]    |  \- commons-logging:commons-logging:jar:1.0.4:compile
[INFO]    +- com.fifesoft:rsyntaxtextarea:jar:3.3.3:compile
[INFO]    +- net.sf.jtidy:jtidy:jar:r938:compile
[INFO]    +- com.thoughtworks.xstream:xstream:jar:1.4.20:compile
[INFO]    |  \- io.github.x-stream:mxparser:jar:1.2.2:compile
[INFO]    |     \- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO]    +- org.apache.logging.log4j:log4j-1.2-api:jar:2.20.0:compile
[INFO]    +- org.apache.logging.log4j:log4j-api:jar:2.20.0:compile
[INFO]    +- org.apache.logging.log4j:log4j-core:jar:2.20.0:compile
[INFO]    +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.20.0:compile
[INFO]    |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO]    +- org.apiguardian:apiguardian-api:jar:1.1.2:compile
[INFO]    +- oro:oro:jar:2.0.8:compile
[INFO]    +- xalan:xalan:jar:2.7.3:compile
[INFO]    +- xalan:serializer:jar:2.7.3:compile
[INFO]    +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO]    +- net.sf.saxon:Saxon-HE:jar:11.5:compile
[INFO]    |  +- org.xmlresolver:xmlresolver:jar:4.6.4:compile
[INFO]    |  |  +- org.apache.httpcomponents.client5:httpclient5:jar:5.1.3:runtime
[INFO]    |  |  |  \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.1.3:runtime
[INFO]    |  |  \- org.apache.httpcomponents.core5:httpcore5:jar:5.1.3:runtime
[INFO]    |  \- org.xmlresolver:xmlresolver:jar:data:4.6.4:compile
[INFO]    +- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.8.22:compile
[INFO]    |  +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.8.22:compile
[INFO]    |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.8.22:compile
[INFO]    +- com.google.auto.service:auto-service-annotations:jar:1.1.1:compile
[INFO]    +- org.jetbrains.kotlinx:kotlinx-coroutines-core:jar:1.7.1:runtime
...

Apparently, Maven discards ALL transitive dependency in case it detects a single issue. I think it is something to be fixed in Maven. In this case, only com.google.auto.service:auto-service-annotations was missing a version, and it is not essential overall. If Maven discarded a single problematic dependency or failed the build, then it would be way better.

@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

I've filed an issue for the Maven team: https://issues.apache.org/jira/browse/MNG-7842
I believe Maven's behavior is not really consistent as dependencyManagement does not help.

@Ardesco
Copy link

Ardesco commented Jul 11, 2023

I would suggest this still needs a fix. Even if Maven does fix this issue it would require all Maven users to upgrade to the latest version of Maven which can be problematic for many corp environments.

For the sake of backwards compatibility I think it would make sense to release a 5.6.2 with the version number specified. You can then deprecate old versions of Maven supported in the future if/when Maven changes the behaviour and start not specifying versions at that point.

Personally I would suggest it's good practice to specify versions, overall it makes it clearer.

@Ardesco
Copy link

Ardesco commented Jul 11, 2023

Works with this pom

<?xml version="1.0" encoding="UTF-8"?>
<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.example</groupId>
    <artifactId>TestBugMaven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.jmeter</groupId>
            <artifactId>ApacheJMeter_core</artifactId>
            <version>5.6.1</version>
        </dependency>
    </dependencies>
</project>

This only fixes the problem if JMeter is a direct dependency. If it's a transitive dependency you are still getting error messages saying that the POM is invalid and that transitive dependencies will not be available.

@hennidk
Copy link

hennidk commented Jul 11, 2023

In my case I am unable to compile my project, getting the error:

... 
Compilation failure
[ERROR]   reason: class file for org.apiguardian.api.API$Status not found
[ERROR] warning: unknown enum constant Status.EXPERIMENTAL
...
error: cannot access Function0
  class file for kotlin.jvm.functions.Function0 not found

Appears to be the same problem as mentioned where Maven discards everything - surely fixing the invalid POM error as suggested is the best way forward?

@jloisel
Copy link
Author

jloisel commented Jul 11, 2023

I also believe versions should always be specified, otherwise it might lead to inconsistencies (which version is it supposed to take then?).

@vlsi vlsi closed this as completed in e424b5f Jul 11, 2023
@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

I also believe versions should always be specified, otherwise it might lead to inconsistencies (which version is it supposed to take then?).

The version might be taken from a dependencyManagement block.

@jloisel
Copy link
Author

jloisel commented Jul 11, 2023

Of course, most people manage them centrally doing so. That being said, the effective pom should include dependency version.

@vlsi
Copy link
Collaborator

vlsi commented Jul 11, 2023

This seems to be resolved in 5.6.2-rc1:

<?xml version="1.0" encoding="UTF-8"?>
<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.example</groupId>
    <artifactId>TestBugMaven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.apache.jmeter</groupId>
            <artifactId>ApacheJMeter_http</artifactId>
            <version>5.6.2</version>
        </dependency>
    </dependencies>

    <repositories>
      <repository>
        <id>jmeter-5.6.2-rc1</id>
        <url>https://repository.apache.org/content/repositories/orgapachejmeter-1087</url>
      </repository>
    </repositories>
</project>

Please try it.

@Ardesco
Copy link

Ardesco commented Jul 11, 2023

That version looks good to me, thanks for the quick turnaround.

@vlsi vlsi unpinned this issue Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants
@vlsi @Ardesco @jloisel @milamberspace @hennidk and others