Small refactoring for eclipse (no duplicate project names allowed).

This commit is contained in:
Tomasz Półgrabia 2024-12-27 15:55:12 +01:00
parent 2514d86189
commit 65f022304f
8 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,41 @@
<?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>
<parent>
<groupId>pl.polgrabia.demos</groupId>
<artifactId>plugin-demo1</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>plugin-demo1-plugin</artifactId>
<packaging>maven-plugin</packaging>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pl.polgrabia.demos</groupId>
<artifactId>plugin-demo1-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,48 @@
package pl.polgrabia.demos.mojos;
import ch.qos.logback.core.util.StringUtil;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import pl.polgrabia.demos.PluginRunner;
import pl.polgrabia.demos.PluginRunnerConfig;
@Mojo(name = "runner")
public class PluginRunnerMojo implements org.apache.maven.plugin.Mojo {
private Log log;
@Parameter(name = "id")
private String id;
@Parameter(name = "name")
private String name;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (StringUtil.isNullOrEmpty(id)) {
id = System.getProperty("maven.runner.id");
}
if (StringUtil.isNullOrEmpty(name)) {
name = System.getProperty("maven.runner.name");
}
new PluginRunner(new PluginRunnerConfig(
id,
name
))
.execute();
}
@Override
public void setLog(Log log) {
this.log = log;
}
@Override
public Log getLog() {
return log;
}
}