Comments (13)
At the moment Gradle's Java plugin does not support the provided
scope out-of-the-box. However, Gradle allows you to define your own configurations so you can model this yourself. You will find many examples on the Gradle forum.
The configuration provided
is not necessarily related to the functionality of this plugin. I am going to close this issue.
from gradle-nexus-plugin.
Creating a provided configuration is easy, but how do I mark that dependency as provided in pom.xml? Isn't that related to this plugin?
I did not find a proper solution for this on the web yet. Could you point me to solution?
from gradle-nexus-plugin.
If you are consuming a published artifact that declares transitive dependencies with scope provided
in its POM, Gradle will not resolve them. It would only be valuable if you need this for documentation purposes. Is that the use case?
from gradle-nexus-plugin.
I am trying to publish a artifact that has a provided dependency on javax.servlet-api and I want the <dependency>
in the published pom to be <scope>provided</scope>
.
from gradle-nexus-plugin.
If you really want to do that you can iterate over the dependencies assigned to the configuration provided
and then modify the POM creation as shown in 53.6.4. Maven POM generation of the user guide. You can probably do that in the modifyPom
closure of this plugin as well. I'd have to have a deeper look.
from gradle-nexus-plugin.
you mean 53.7 in http://gradle.org/docs/current/userguide/maven_plugin.html? That results in this error: Could not find property 'mavenDeployer' on repository container.
If I'm just doing
def installer = install.repositories.mavenInstaller
[installer]*.pom*.whenConfigured { pom ->
pom.dependencies.removeAll { dep -> dep.scope == 'test' }
pom.dependencies.findAll {dep -> dep.artifactId == 'javax.servlet-api' }.each {
it.scope = 'provided'; println it
}
}
The pom does not get modified, even though the println it
prints out the correct dependency.
It would be so great if you could take a look on this. I think this and the possibility to mark a dependency as optional is quite important, don't you think? Or would it be ok in your opinion to just exclude those deps from the pom.xml?
Thank you for you support!
from gradle-nexus-plugin.
It would have to be coordinated with some internals of the plugin. I need to defer some evaluation order etc. as part of the implementation. modifyPom
is something exposed by the Nexus plugin and not the Maven plugin. I am going to reopen this. At the moment I won't have to much time to look into this issue. If you want to tackle this, the right away of approach it would be to add an integration test to the plugin.
from gradle-nexus-plugin.
Here's an example that demonstrates how to make it work.
from gradle-nexus-plugin.
Awesome, thanks a lot!
But that's not quite it, because the pom won't contain compile dependencies anymore, so you have to add this snippet:
project.configurations.compile.allDependencies.each { dep ->
dependency {
groupId dep.group
artifactId dep.name
version dep.version
scope 'compile'
}
}
Also, I would slightly modify the provided
configuration:
configurations {
provided
compile.extendsFrom provided
}
This way you don't get compile errors if you call a method from a provided dependency and IntellJ will automatically add the jar to the classpath.
from gradle-nexus-plugin.
I am probably overriding the generated dependencies POM metadata with my modification. I requires some additional tweaking. Next time I have some spare time I will fix it.
There are different ways to model the provided
configuration. The test case only demonstrates that you can modify the POM. It's not supposed to demonstrate the "correct" usage of provided
per se.
from gradle-nexus-plugin.
I just wanted to add this in case someone else has the same usecase as me.
from gradle-nexus-plugin.
Done. I also fixed the dependencies generation. BTW: Why don't you use the providedCompile
configuration from the War plugin for your Servlet dependency?
from gradle-nexus-plugin.
Because I don't want to create a war but a jar. I'm the developer of a open source application performance monitoring project (www.stagemonitor.org). For the web agent I have to have a dependency to the servlet-api to get information about incoming requests, register the monitoring filter and inject a monitoring toolbar into the site's html.
from gradle-nexus-plugin.
Related Issues (20)
- Multiple GPG key passphase questions in multi-project builds HOT 2
- uploadArchives task fails with Gradle 2.3+ when distZip and distTar are not enabled HOT 4
- How to set classifier for archives HOT 4
- how to add additional archives to publish HOT 3
- "Must specify a repository for deployment" error HOT 4
- Cycle detected HOT 2
- Encrypt credentials in properties file HOT 1
- Make authorization error more user-friendly HOT 3
- gradle
- uploadArchives logging needed HOT 1
- ShadowJar + GradleNexusPlugin : Could not publish configuration 'archives' HOT 4
- How can I manually say upload to snapshot or stable repository ? HOT 6
- How force project version on Nexus HOT 2
- BOM support HOT 2
- Gradle 4.10.1 breaks modifyPom HOT 4
- uploadArchives fails with "Cannot invoke method readPassword() on null object" HOT 1
- Gradle Kotli-Dsl example HOT 3
- MavenPlugin is deprecated and scheduled to be removed in Gradle 7.0 HOT 2
- How to use in Multi-module project?
- Publish to Gradle Plugins repo HOT 3
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-nexus-plugin.