HHH-6412 - hibernate version is not injected by the injection plugin
This commit is contained in:
parent
b0df669cbc
commit
020c919245
|
@ -47,6 +47,7 @@ import javassist.bytecode.ConstantAttribute;
|
|||
import javassist.bytecode.FieldInfo;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
|
||||
|
@ -56,7 +57,7 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class InjectionAction implements Action {
|
||||
public class InjectionAction implements Action<Task> {
|
||||
private static final Logger log = LoggerFactory.getLogger( InjectionAction.class );
|
||||
|
||||
private final Project project;
|
||||
|
@ -75,7 +76,7 @@ public class InjectionAction implements Action {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(Object o) {
|
||||
public void execute(Task task) {
|
||||
final ClassLoader runtimeScopeClassLoader = buildRuntimeScopeClassLoader();
|
||||
|
||||
loaderClassPath = new LoaderClassPath( runtimeScopeClassLoader );
|
||||
|
|
|
@ -40,7 +40,7 @@ public class InjectionPlugin implements Plugin<Project> {
|
|||
Injection versionInjection = new Injection( project.getVersion().toString() );
|
||||
versionInjection.into( "org.hibernate.Version", "getVersionString" );
|
||||
injectionAction.addInjection( versionInjection );
|
||||
project.getTasks().findByName( "jar" ).doLast( injectionAction );
|
||||
project.getTasks().findByName( "compileJava" ).doLast( injectionAction );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
* Information about the Hibernate version.
|
||||
*
|
||||
|
@ -33,8 +37,11 @@ public class Version {
|
|||
return "[WORKING]";
|
||||
}
|
||||
|
||||
public static void logVersion() {
|
||||
Logger.getMessageLogger( CoreMessageLogger.class, Version.class.getName() ).version( getVersionString() );
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println( "Hibernate version " + getVersionString() );
|
||||
System.out.println( "Hibernate Core {" + getVersionString() + "}" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,8 +204,8 @@ public final class Environment implements AvailableSettings {
|
|||
}
|
||||
|
||||
static {
|
||||
Version.logVersion();
|
||||
|
||||
LOG.version(Version.getVersionString());
|
||||
Map<Integer,String> temp = new HashMap<Integer,String>();
|
||||
temp.put( Connection.TRANSACTION_NONE, "NONE" );
|
||||
temp.put( Connection.TRANSACTION_READ_UNCOMMITTED, "READ_UNCOMMITTED" );
|
||||
|
|
|
@ -1443,7 +1443,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void validatorNotFound();
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Hibernate %s", id = 412)
|
||||
@Message(value = "Hibernate Core {%s}", id = 412)
|
||||
void version(String versionString);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
|
|
Loading…
Reference in New Issue