-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-18644 - New and improved hibernate-maven-plugin
Signed-off-by: Koen Aers <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,586 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
36 changes: 36 additions & 0 deletions
36
local-build-plugins/src/main/java/org/hibernate/build/maven/embedder/RunMavenTask.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.hibernate.build.maven.embedder; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.provider.ListProperty; | ||
import org.gradle.api.provider.Property; | ||
import org.gradle.api.services.ServiceReference; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.TaskAction; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public abstract class RunMavenTask extends DefaultTask { | ||
|
||
@ServiceReference | ||
abstract Property<MavenEmbedderService> getMavenEmbedderService(); | ||
|
||
@Input | ||
abstract Property<String> getGoals(); | ||
|
||
@Input | ||
abstract ListProperty<String> getArguments(); | ||
|
||
@TaskAction | ||
public void run() { | ||
getMavenEmbedderService().get().execute( constructTaskAndArgs() ); | ||
} | ||
|
||
private String[] constructTaskAndArgs() { | ||
List<String> args = new ArrayList<String>(); | ||
args.add( getGoals().get() ); | ||
args.addAll( getArguments().get() ); | ||
return args.toArray(new String[0]); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...-plugins/src/main/java/org/hibernate/build/maven/embedder/logging/Slf4jConfiguration.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.hibernate.build.maven.embedder.logging; | ||
|
||
import org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration; | ||
import org.slf4j.LoggerFactory; | ||
import org.slf4j.impl.MavenSlf4jSimpleFriend; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
public class Slf4jConfiguration extends Slf4jSimpleConfiguration { | ||
@Override | ||
public void activate() { | ||
resetLoggerFactory(); | ||
initMavenSlf4jSimpleFriend(); | ||
} | ||
|
||
private void resetLoggerFactory() { | ||
try { | ||
Method m = LoggerFactory.class.getDeclaredMethod("reset", new Class[]{}); | ||
m.setAccessible(true); | ||
m.invoke(null); | ||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private void initMavenSlf4jSimpleFriend() { | ||
MavenSlf4jSimpleFriend.init(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
local-build-plugins/src/main/resources/META-INF/maven/slf4j-configuration.properties
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext org.hibernate.build.maven.embedder.logging.Slf4jConfiguration |
Oops, something went wrong.