BAEL-4796 How to display a message in Maven (#10731)

Co-authored-by: Adrianna Zychewicz <adrianna.zychewicz@decerto.pl>
This commit is contained in:
makapszenna 2021-05-13 05:47:03 +02:00 committed by GitHub
parent e24d787fb1
commit 3b9d30d26b
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1 @@
logs/

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>maven-printing-plugins</artifactId>
<name>maven-printing-plugins</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>antrun-plugin</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Hello, world"/>
<echo message="Embed a line break: ${line.separator}"/>
<echo message="Build dir: ${project.build.directory}" level="info"/>
<echo file="${basedir}/logs/log-ant-run.txt" append="true"
message="Save to file!"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.ekryd.echo-maven-plugin</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>echo-maven-plugin-1</id>
<phase>package</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>Hello, world</message>
<message>Embed a line break: ${line.separator}</message>
<message>ArtifactId is ${project.artifactId}</message>
<level>INFO</level>
<toFile>/logs/log-echo.txt</toFile>
<append>true</append>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
log.info('Test message: {}', 'Hello, World!')
log.info('Embed a line break {}', System.lineSeparator())
log.info('ArtifactId is: ${project.artifactId}')
log.warn('Message only in debug mode')
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -30,6 +30,7 @@
<module>version-collision</module>
<module>version-overriding-plugins</module>
<module>versions-maven-plugin</module>
<module>maven-printing-plugins</module>
</modules>
</project>