Comments (8)
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.
More information here: gradle/gradle#1118.
from gradle-maven-publish-plugin.
I don't think it's that easy
from gradle-maven-publish-plugin.
What's the use case for this?
from gradle-maven-publish-plugin.
I would like the POM.xml file's dependencies to use 'implementation' or 'compile' instead of 'runtime'.
from gradle-maven-publish-plugin.
But if they are your dependencies why don't you make them implementation
or compile
from the beginning?
from gradle-maven-publish-plugin.
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.
Thanks for the help and explanation @vanniktech and @gabrielittner!
from gradle-maven-publish-plugin.
Related Issues (20)
- Support Sonatype Portal Publisher API HOT 4
- Publishing parts of a project with different versions leads to wrong repo being used
- Cannot publish artifacts in multimodule project HOT 2
- Is there a way to specify source code publish flag according to the targets? HOT 5
- In memory GPG key HOT 3
- Disable signing for specific tasks HOT 3
- [Question] How to publish custom artifact to Maven Central? HOT 2
- Upload failed: {"error":{"message":"Authentication Failed"}} HOT 11
- Java8 Support HOT 1
- Publishing to two repositories with different platform configurations HOT 2
- Any way to publish an Android library using Dokka generated docs? HOT 1
- Update plugin in gradle plugin site HOT 1
- publishing to Maven Central via the Portal Publisher API HOT 4
- Task ':lib:generateMetadataFileForMavenPublication' uses this output of task ':lib:plainJavadocJar' without declaring an explicit or implicit dependency. HOT 2
- Consider adding credentials example for in-memory key to documentation HOT 2
- Cannot perform signing task ':lib:signMavenPublication' because it has no configured signatory HOT 7
- Add an option to not publish test fixtures HOT 4
- How to publish multi-module project as a single artifact HOT 2
- How to use plugin on Github Actions? HOT 3
- [CENTRAL_PORTAL] java.lang.IllegalArgumentException: Cannot set the value of task ':plugin-collector:createStagingRepository' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-maven-publish-plugin.