pivotal-cf / java-cfenv

Apache License 2.0
91 stars 56 forks source link

The POM for io.pivotal.cfenv:java-cfenv:jar:3.1.0 is invalid #226

Closed Icetea1991 closed 9 months ago

Icetea1991 commented 9 months ago

Describe the bug

The pom seems to be invalid and no transitive dependencies are available. I have to import

    <dependency>
        <groupId>com.cedarsoftware</groupId>
        <artifactId>json-io</artifactId>
        <version>4.14.0</version>
    </dependency>

Otherweise it would not work

Reproduction steps

  1. Create a Java project
  2. Add pivotal plain java-cfenv as dependency
  3. Try to build maven project ...

Expected behavior

I expect the dependency:

    <dependency>
        <groupId>io.pivotal.cfenv</groupId>
        <artifactId>java-cfenv</artifactId>
        <version>3.1.0</version>
    </dependency>

To work properly without any workarounds from my side

Additional context

No response

abelsromero commented 9 months ago

I did a quick review, it seems to me an issue with how json-io publishes the jar. The dependency in java-cfenv is correctly set as compile but json-io is published as packaging=bundle which is not standard Maven.

I see that not only mvn dependency:tree does not list the dependency, but Maven does not even try to pull it, not a single file or directory for json-io in local .m2. But at the same time I see no issue or docs mentioning any particular method for Maven (Gradle seems to work fine) 🤔

jensmatw commented 9 months ago

I think json-io is not the root issue but the spring-boot-starter-test dependency in java-cfenv. Maven with -X option prints:

[WARNING] The POM for io.pivotal.cfenv:java-cfenv:jar:3.1.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for io.pivotal.cfenv:java-cfenv:3.1.0
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @

In the generated pom.xml of java-cfenv there is a version for json-io and jmockit, but not for spring-boot-starter-test.

I'm not using gradle, but maybe it could be fixed by adding the :${springBootVersion} in https://github.com/pivotal-cf/java-cfenv/blob/471305d89a37af2c8a47250e9d260936dde40e13/java-cfenv/build.gradle#L11 and https://github.com/pivotal-cf/java-cfenv/blob/471305d89a37af2c8a47250e9d260936dde40e13/java-cfenv/build.gradle#L20

abelsromero commented 9 months ago

@jensmatw is on point! I tested adding the version to the local pom and the resolution works fine. Also tested with the main branch (./gradlew :java-cfenv:publishToMavenLocal) after this fix https://github.com/pivotal-cf/java-cfenv/commit/b161c4e459273db7cc800f0add4ace24d7ea9208 and seems to be already solved 🎉

anthonydahanne commented 9 months ago

hello, Yes, it was fixed recently, but rather in this commit https://github.com/pivotal-cf/java-cfenv/pull/227/commits/a4a30e2cfa547a6c9d3747441d12c13f3647c70e - anyways, sorry for the trouble, version 3.1.1 just got out with the fix., https://github.com/pivotal-cf/java-cfenv/releases/tag/v3.1.1

Enjoy!