Last active
October 5, 2020 19:26
-
-
Save aalmiray/ce9b395f16513ed74d58d674f365a31d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.kordamp.gradle.echo' version '0.40.0' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.kordamp.gradle.echo' version '0.40.0' | |
} | |
echo { | |
message = 'Hello from task' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.kordamp.gradle.echo' version '0.40.0' | |
} | |
project.ext.set('echo.message', 'Hello from build.gradle') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.transform.CompileStatic | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.provider.Property | |
import org.gradle.api.provider.Provider | |
import org.gradle.api.tasks.Input | |
import org.gradle.api.tasks.Internal | |
import org.gradle.api.tasks.Optional | |
import org.gradle.api.tasks.TaskAction | |
import org.gradle.api.tasks.options.Option | |
import org.kordamp.gradle.property.SimpleStringState | |
import org.kordamp.gradle.property.StringState | |
@CompileStatic | |
class EchoTask extends DefaultTask { | |
private final StringState message | |
EchoTask() { | |
message = SimpleStringState.of(this, 'echo.message', '') | |
} | |
@Option(option='echo-message', description = 'The message to write') | |
void setMessage(String message) { | |
getMessage().set(message) | |
} | |
@Internal | |
Property<String> getMessage() { | |
message.property | |
} | |
@Input | |
@Optional | |
Provider<String> getResolvedMessage() { | |
message.provider | |
} | |
@TaskAction | |
void echo() { | |
println getResolvedMessage().get() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.acme</groupId> | |
<artifactId>sample</artifactId> | |
<version>0.0.0-SNAPSHOT</version> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>com.github.ekryd.echo-maven-plugin</groupId> | |
<artifactId>echo-maven-plugin</artifactId> | |
<version>1.2.0</version> | |
<inherited>false</inherited> | |
<executions> | |
<execution> | |
<id>echo</id> | |
<goals> | |
<goal>echo</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.acme</groupId> | |
<artifactId>sample</artifactId> | |
<version>0.0.0-SNAPSHOT</version> | |
<properties> | |
<echo.message>Hello from pom.xml</echo.message> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>com.github.ekryd.echo-maven-plugin</groupId> | |
<artifactId>echo-maven-plugin</artifactId> | |
<version>1.2.0</version> | |
<inherited>false</inherited> | |
<executions> | |
<execution> | |
<id>echo</id> | |
<goals> | |
<goal>echo</goal> | |
</goals> | |
<configuration> | |
<message>hello</message> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.acme</groupId> | |
<artifactId>sample</artifactId> | |
<version>0.0.0-SNAPSHOT</version> | |
<properties> | |
<echo.message>Hello from pom.xml</echo.message> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>com.github.ekryd.echo-maven-plugin</groupId> | |
<artifactId>echo-maven-plugin</artifactId> | |
<version>1.2.0</version> | |
<inherited>false</inherited> | |
<executions> | |
<execution> | |
<id>echo</id> | |
<goals> | |
<goal>echo</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment