Skip to content

Commit

Permalink
Use plugins DSL in Javadoc code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
rieske committed Apr 20, 2020
1 parent 1fad433 commit 4167c07
Show file tree
Hide file tree
Showing 48 changed files with 271 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
* An example showing how to refer to a given configuration by name
* in order to get hold of all dependencies (e.g. jars, but only)
* <pre class='autoTested'>
* apply plugin: 'java' //so that I can use 'implementation', 'compileClasspath' configuration
* plugins {
* id 'java' //so that I can use 'implementation', 'compileClasspath' configuration
* }
*
* dependencies {
* implementation 'org.slf4j:slf4j-api:1.7.26'
Expand All @@ -65,7 +67,9 @@
*
* An example showing how to declare and configure configurations
* <pre class='autoTested'>
* apply plugin: 'java' //so that I can use 'implementation', 'testImplementation' configurations
* plugins {
* id 'java' // so that I can use 'implementation', 'testImplementation' configurations
* }
*
* configurations {
* //adding a configuration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public interface ModuleDependency extends Dependency, HasConfigurableAttributes<
* then consider using forced versions' feature: {@link ResolutionStrategy#force(Object...)}.
*
* <pre class='autoTested'>
* apply plugin: 'java' //so that I can declare 'implementation' dependencies
* plugins {
* id 'java' // so that I can declare 'implementation' dependencies
* }
*
* dependencies {
* implementation('org.hibernate:hibernate:3.1') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
* <p>
* Examples:
* <pre class='autoTested'>
* apply plugin: 'java' //so that there are some configurations
* plugins {
* id 'java' // so that there are some configurations
* }
*
* configurations.all {
* resolutionStrategy {
Expand Down Expand Up @@ -70,7 +72,9 @@ public interface ResolutionStrategy {
* The check includes both first level and transitive dependencies. See example below:
*
* <pre class='autoTested'>
* apply plugin: 'java' //so that there are some configurations
* plugins {
* id 'java' // so that there are some configurations
* }
*
* configurations.all {
* resolutionStrategy.failOnVersionConflict()
Expand Down Expand Up @@ -129,7 +133,9 @@ public interface ResolutionStrategy {
* This applies to both first level and transitive dependencies. See example below:
*
* <pre class='autoTested'>
* apply plugin: 'java' //so that there are some configurations
* plugins {
* id 'java' // so that there are some configurations
* }
*
* configurations.all {
* resolutionStrategy.preferProjectModules()
Expand Down Expand Up @@ -191,7 +197,9 @@ public interface ResolutionStrategy {
* </ul>
* Example:
* <pre class='autoTested'>
* apply plugin: 'java' //so that there are some configurations
* plugins {
* id 'java' // so that there are some configurations
* }
*
* configurations.all {
* resolutionStrategy.force 'asm:asm-all:3.3.1', 'commons-io:commons-io:1.4'
Expand All @@ -212,7 +220,9 @@ public interface ResolutionStrategy {
* <p>
* Example:
* <pre class='autoTested'>
* apply plugin: 'java' //so that there are some configurations
* plugins {
* id 'java' // so that there are some configurations
* }
*
* configurations.all {
* resolutionStrategy.forcedModules = ['asm:asm-all:3.3.1', 'commons-io:commons-io:1.4']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
*
* <p>Example shows a basic way of removing certain transitive dependencies from one of our dependencies.</p>
* <pre class='autoTested'>
* apply plugin: 'java'
* plugins {
* id 'java'
* }
*
* repositories {
* mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
*
* <p>Example shows a basic way of declaring dependencies.
* <pre class='autoTested'>
* apply plugin: 'java'
* //so that we can use 'implementation', 'testImplementation' for dependencies
* plugins {
* id 'java' // so that we can use 'implementation', 'testImplementation' for dependencies
* }
*
* dependencies {
* //for dependencies found in artifact repositories you can use
Expand Down Expand Up @@ -87,7 +88,9 @@
* </ul>
*
* <pre class='autoTestedWithDeprecations'>
* apply plugin: 'java' //so that I can declare 'implementation' dependencies
* plugins {
* id 'java' // so that I can declare 'implementation' dependencies
* }
*
* dependencies {
* implementation('org.hibernate:hibernate:3.1') {
Expand All @@ -112,7 +115,9 @@
* </ul>
*
* <pre class='autoTested'>
* apply plugin: 'java' //so that I can declare 'implementation' dependencies
* plugins {
* id 'java' // so that I can declare 'implementation' dependencies
* }
*
* dependencies {
* //configuring dependency to specific configuration of the module
Expand Down Expand Up @@ -161,8 +166,9 @@
* org.gradle.api.artifacts.ExternalModuleDependency}.</p>
*
* <pre class='autoTested'>
* apply plugin: 'java'
* //so that we can use 'implementation', 'testImplementation' for dependencies
* plugins {
* id 'java' // so that we can use 'implementation', 'testImplementation' for dependencies
* }
*
* dependencies {
* //for dependencies found in artifact repositories you can use
Expand Down Expand Up @@ -195,8 +201,9 @@
* <code><i>configurationName</i> files('a file')</code>
*
* <pre class='autoTested'>
* apply plugin: 'java'
* //so that we can use 'implementation', 'testImplementation' for dependencies
* plugins {
* id 'java' // so that we can use 'implementation', 'testImplementation' for dependencies
* }
*
* dependencies {
* //declaring arbitrary files as dependencies
Expand Down Expand Up @@ -225,8 +232,10 @@
*
* <pre class='autoTested'>
* //Our Gradle plugin is written in groovy
* apply plugin: 'groovy'
* //now we can use the 'implementation' configuration for declaring dependencies
* plugins {
* id 'groovy'
* }
* // now we can use the 'implementation' configuration for declaring dependencies
*
* dependencies {
* //we will use the Groovy version that ships with Gradle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
* A builder to construct a query that can resolve selected software artifacts of the specified components.
*
* <pre class='autoTested'>
* apply plugin: 'java'
* plugins {
* id 'java'
* }
*
* task resolveCompileSources {
* doLast {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
* Similar to {@link org.gradle.api.tasks.Exec}, but starts a JVM with the given classpath and application class.
* </p>
* <pre class='autoTested'>
* apply plugin: 'java'
* plugins {
* id 'java'
* }
*
* task runApp(type: JavaExec) {
* classpath = sourceSets.main.runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
* The content and location of the generate project file can be modified by the supplied methods:
*
* <pre class='autoTested'>
* apply plugin: "cpp"
* apply plugin: "visual-studio"
* plugins {
* id 'cpp'
* id 'visual-studio'
* }
*
* model {
* visualStudio {
* projects.all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
* The content and location of the generate solution file can be modified by the supplied methods:
*
* <pre class='autoTested'>
* apply plugin: "visual-studio"
* plugins {
* id 'visual-studio'
* }
*
* model {
* visualStudio {
* solution {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
* if the defaults don't match your needs.
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* configurations {
* provided
Expand Down Expand Up @@ -95,8 +97,10 @@
* Examples of advanced configuration:
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* eclipse {
* classpath {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
* Enables fine-tuning jdt details of the Eclipse plugin
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* eclipse {
* jdt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
* First point of entry for customizing Eclipse project generation.
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* apply plugin: 'eclipse-wtp' //for web projects only
* plugins {
* id 'java'
* id 'eclipse'
* id 'eclipse-wtp' // for web projects only
* }
*
* eclipse {
* pathVariables 'GRADLE_HOME': file('/best/software/gradle'), 'TOMCAT_HOME': file('../tomcat')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
* Bear in mind that usually you don't have configure eclipse project directly because Gradle configures it for free!
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* eclipse {
* project {
Expand Down Expand Up @@ -95,8 +97,10 @@
* Examples of advanced configuration:
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* eclipse {
* project {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
* More interesting examples you will find in docs for {@link EclipseWtpComponent} and {@link EclipseWtpFacet}
*
* <pre class='autoTested'>
* apply plugin: 'war' //or 'ear' or 'java'
* apply plugin: 'eclipse-wtp'
* plugins {
* id 'war' // or 'ear' or 'java'
* id 'eclipse-wtp'
* }
*
* eclipse {
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
* Bear in mind that usually you don't have to configure them directly because Gradle configures it for free!
*
* <pre class='autoTested'>
* apply plugin: 'war' //or 'ear' or 'java'
* apply plugin: 'eclipse-wtp'
* plugins {
* id 'war' // or 'ear' or 'java'
* id 'eclipse-wtp'
* }
*
* configurations {
* someInterestingConfiguration
Expand Down Expand Up @@ -100,8 +102,10 @@
* Examples of advanced configuration:
*
* <pre class='autoTested'>
* apply plugin: 'war'
* apply plugin: 'eclipse-wtp'
* plugins {
* id 'war'
* id 'eclipse-wtp'
* }
*
* eclipse {
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
* Advanced configuration closures beforeMerged and whenMerged receive {@link WtpFacet} object as parameter.
*
* <pre class='autoTested'>
* apply plugin: 'war' //or 'ear' or 'java'
* apply plugin: 'eclipse-wtp'
* plugins {
* id 'war' // or 'ear' or 'java'
* id 'eclipse-wtp'
* }
*
* eclipse {
* wtp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
* or both. The following example excludes the 'node_modules' folder.
*
* <pre class='autoTested'>
* apply plugin: 'java'
* apply plugin: 'eclipse'
* plugins {
* id 'java'
* id 'eclipse'
* }
*
* eclipse {
* project {
Expand Down
Loading

0 comments on commit 4167c07

Please sign in to comment.