Comments (5)
My main concern was building a jar file that Sonar recognizes as plugin
Here is a minimal build.gradle
to achieve this:
plugins {
id "java-library"
id "com.github.johnrengelman.shadow" version "4.0.3"
}
repositories {
jcenter()
}
ext {
sonar_version = "6.7.4"
}
version = '0.0.1-SNAPSHOT'
dependencies {
compileOnly "org.sonarsource.sonarqube:sonar-plugin-api:${sonar_version}"
//more dependencies as needed
}
// https://docs.sonarqube.org/display/DEV/Build+Plugin
jar {
manifest {
attributes 'Plugin-Key': 'myPlugin',
'Plugin-Name': 'Demo Plugin',
'Plugin-Version': "$project.version",
'Plugin-Class': 'my.plugin.MainClass'
//more attributes as necessary
}
}
With this build, you will have a working Sonar plugin with all dependencies bundled in the jar (thanks to the Shadow plugin) by running gradle shadowJar
from gradle-sonar-packaging-plugin.
For someone else having this problem:
I've switched to the shadow plugin + adding the proper keys to the jar manifest using regular Gradle
from gradle-sonar-packaging-plugin.
And here is the warning when running the plugin with Gradle 4.10.3
> Task :project:pluginPackaging
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0.
from gradle-sonar-packaging-plugin.
I've seen a stale branch for gradle cross-version tests, maybe it's time to revive it. -> https://github.com/iwarapter/gradle-sonar-packaging-plugin/compare/feature/travis-gradle-matrix
from gradle-sonar-packaging-plugin.
interesting... is your project open source and can you provide a link to it?
from gradle-sonar-packaging-plugin.
Related Issues (20)
- Package dependencies better
- Plugin packaging: nearly there, except Sonar does not accept it... HOT 15
- Change packaging finalizedBy dependency
- Build goes into endless loop and craches HOT 10
- org.codehaus.sonar:sonar-plugin-api or org.sonarsource.sonarqube:sonar-plugin-api should be declared in dependencies HOT 1
- xstream not added to the output plugin jar HOT 15
- The plugin fails with Gradle 2.11 HOT 1
- Refactor out internal api calls HOT 1
- localDeploy does not work
- 0.1.4: the plugin fails to account for gradle 2.12's new (and longly awaited) compileOnly HOT 12
- LoggingManager.setLevel(LogLevel) has been deprecated HOT 1
- Build failed if using sonar-plugin-api ver-5.5 and above HOT 3
- `pluginPackaging` failed in gradle multiproject HOT 5
- Support `sonarQubeMinVersion` property HOT 2
- Deprecation warning with gradle 3.5 / support for gradle 4.0 HOT 11
- org.sonarsource.sonarqube:sonar-plugin-api should be declared in dependencies problem HOT 8
- Plugin class not found after just updating kotlin dependencies HOT 4
- `implementation` dependencies not resolved
- Could not get unknown property 'compile' 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-sonar-packaging-plugin.