HHH-13656 Can not build and run test on Eclipse IDE

Eclipse windows
This commit is contained in:
hailtondecastro 2019-10-29 22:18:51 -03:00 committed by Steve Ebersole
parent e651bd7369
commit 0f859e7bb4
2 changed files with 36 additions and 49 deletions

View File

@ -9,6 +9,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.gradle.plugins.ide.eclipse.model.Library
import org.apache.tools.ant.taskdefs.condition.Os
import java.io.StringWriter
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply plugin: Antlr4Plugin
@ -183,24 +184,31 @@ eclipse {
project {
file {
withXml { provider ->
//println('name:')
//println(name)
def projectDescriptionNode = provider.asNode()
// projectDescriptionNode.children( ).each { nodeItem ->
// println( 'nodeItem: ' + nodeItem )
// }
def buildSpecNode = projectDescriptionNode.children().find { child -> child.name( ).equals('buildSpec') }
def buildCommandMkp = new StreamingMarkupBuilder().bind {
buildCommand {
name( 'org.eclipse.ui.externaltools.ExternalToolBuilder' )
triggers( 'full,incremental,' )
def buildCommandSW = new StringWriter()
def buildCommandXml = new MarkupBuilder(new IndentPrinter(buildCommandSW, " ", true))
buildCommandXml.doubleQuotes = true
buildCommandXml.buildCommand( ) {
//[java - Groovy's MarkupBuilder exception on generating "id" XML tag - Stack Overflow](https://stackoverflow.com/a/14284927/1350308)
"${'name'}"( "org.eclipse.ui.externaltools.ExternalToolBuilder" ) { }
triggers( 'auto,full,incremental,' )
arguments( ) {
dictionary( ) {
key ( 'LaunchConfigHandle' )
value ( '<project>/.externalToolBuilders/gradlew_process_test_resources.launch' )
}
dictionary( ) {
key ( 'incclean' )
value ( true )
}
}
}
def buildCommandNode = new XmlParser().parseText( buildCommandMkp.toString() )
def buildCommandNode = new XmlParser().parseText( buildCommandSW.toString() )
//println('strWriter:')
//println(buildCommandSW.toString())
buildSpecNode.append( buildCommandNode )
}
}
@ -221,9 +229,18 @@ eclipse {
} else {
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew').absolutePath )
}
booleanAttribute( key:'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', value: false )
stringAttribute(
key: 'org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE',
value: '\${working_set:<?xml version="1.0" encoding="UTF-8"?> \
<resources> \
<item path="/'+"${project.name}"+'/src/test/bundles" type="2"/> \
<item path="/'+"${project.name}"+'/src/test/resources" type="2"/> \
</resources>}'
)
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', value: 'incremental,auto,' )
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', value: 'hibernate-core:processTestResources --no-daemon' )
booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: 'true' )
booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: true )
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', value: file('../').absolutePath )
}
xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task")
@ -243,10 +260,10 @@ eclipse {
}
stringAttribute( key: 'org.eclipse.jdt.junit.CONTAINER', value: "=${project.name}" )
stringAttribute( key: 'org.eclipse.jdt.junit.EXCLUDE_TAGS', value: '' )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: 'false' )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: 'true' )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: false )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: true )
stringAttribute( key: 'org.eclipse.jdt.junit.INCLUDE_TAGS', value: 'RunnableIdeTest' )
booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: 'false' )
booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: false )
stringAttribute( key: 'org.eclipse.jdt.junit.TESTNAME', value: '' )
stringAttribute( key: 'org.eclipse.jdt.junit.TEST_KIND', value: 'org.eclipse.jdt.junit.loader.junit5' )
stringAttribute( key: 'org.eclipse.jdt.launching.MAIN_TYPE', value: '' )
@ -274,10 +291,10 @@ eclipse {
List newSourceSet = []
classpath.entries.each { item ->
if( !exclusionSourceSet.contains( item.path ) ) {
println( 'INCLUDING: ' + item )
//println( 'INCLUDING: ' + item )
newSourceSet.add( item )
} else {
println( 'NOT INCLUDING: ' + item )
//println( 'NOT INCLUDING: ' + item )
}
}
@ -291,35 +308,7 @@ eclipse {
resourceMain,
resourceTest
]
// def resourceMain = new Library( frf.fromFile( file ( 'target/resources/main' ) ) )
// def resourceTest = new Library( frf.fromFile( file ( 'target/resources/test' ) ) )
println( 'newSourceSet:' )
println( newSourceSet )
classpath.entries = newSourceSet
// classpath.configure([
// aptMain,
// aptTest,
// resourceMain,
// resourceTest
// ])
// Find the "source" entry and add the exclude for the folder containing our super-source code
// Set exclusionSourceSet = [
// 'src/main/resources',
// 'src/test/resources'
// ]
// Set newSourceSet = []
// classpath.entries.each { item ->
// if( !exclusionSourceSet.contains( item.path ) ) {
// println( 'INCLUDING: ' + item )
// newSourceSet.add( item )
// } else {
// println( 'NOT INCLUDING: ' + item )
// }
// }
// println( 'newSourceSet:' )
// println( newSourceSet )
}
}
}

View File

@ -63,8 +63,6 @@ eclipse {
//println( 'NOT INCLUDING: ' + item )
}
}
println( 'newSourceSet:' )
println( newSourceSet )
def hibernateCore = new ProjectDependency('/hibernate-core')
newSourceSet += [