GithubHelp home page GithubHelp logo

Comments (8)

gabrielittner avatar gabrielittner commented on July 17, 2024 1

Let's say you have module A and module B. Module A depends on module B. Any implementation dependency of module B will be put on the runtime classpath of module A. Any api dependency of module B will be put on both the compilation and the runtime classpath of module A. That's the behavior with just local Gradle modules.

Now if you take dependencies declared in a pom runtime will be put on the runtime classpath, while compile will be put on both the compilation and the runtime classpath.

So having an implementation dependency show up as runtime scope in the pom matches the behavior of a dependency between Gradle modules. Changing the scope of an implementation dependency to compile would even be wrong because it would make that dependency available to the compilation classpath of consumers, in the end all your dependencies would behave like api dependencies which defeats the point of having implementation.

from gradle-maven-publish-plugin.

jaredsburrows avatar jaredsburrows commented on July 17, 2024

More information here: gradle/gradle#1118.

from gradle-maven-publish-plugin.

vanniktech avatar vanniktech commented on July 17, 2024

I don't think it's that easy

from gradle-maven-publish-plugin.

vanniktech avatar vanniktech commented on July 17, 2024

What's the use case for this?

from gradle-maven-publish-plugin.

jaredsburrows avatar jaredsburrows commented on July 17, 2024

I would like the POM.xml file's dependencies to use 'implementation' or 'compile' instead of 'runtime'.

from gradle-maven-publish-plugin.

vanniktech avatar vanniktech commented on July 17, 2024

But if they are your dependencies why don't you make them implementation or compile from the beginning?

from gradle-maven-publish-plugin.

jaredsburrows avatar jaredsburrows commented on July 17, 2024

This is apart of Gradle. I am saying you can override this in your plugin.

You plugin is being used with ktlint: https://github.com/pinterest/ktlint/blob/master/build.gradle#L3.

To repro:
git clone https://github.com/pinterest/ktlint
cd ktlint
gradlew install
cat ktlint/build/poms/pom-default.xml

Click for POM contents
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.pinterest</groupId>
  <artifactId>ktlint</artifactId>
  <version>0.34.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-core</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-reporter-checkstyle</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-reporter-json</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-reporter-plain</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-ruleset-experimental</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-ruleset-standard</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.pinterest.ktlint</groupId>
      <artifactId>ktlint-test</artifactId>
      <version>0.34.0-SNAPSHOT</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib</artifactId>
      <version>1.3.31</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-compiler-embeddable</artifactId>
      <version>1.3.31</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.github.shyiko.klob</groupId>
      <artifactId>klob</artifactId>
      <version>0.2.1</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-api</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-spi</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-util</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-impl</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-connector-basic</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-file</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-http</artifactId>
      <version>1.1.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>18.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-nop</artifactId>
      <version>1.6.2</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-aether-provider</artifactId>
      <version>3.2.5</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>info.picocli</groupId>
      <artifactId>picocli</artifactId>
      <version>3.9.6</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.9.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.jimfs</groupId>
      <artifactId>jimfs</artifactId>
      <version>1.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

As you can see, there are plenty of dependencies that are scoped as "runtime" instead of "compile" or "implementation" even though all the dependencies in ktlint are in the "implementation" configuration.

from gradle-maven-publish-plugin.

jaredsburrows avatar jaredsburrows commented on July 17, 2024

Thanks for the help and explanation @vanniktech and @gabrielittner!

from gradle-maven-publish-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.