2012-11-27 07:36:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								import  org.gradle.plugins.ide.eclipse.model.ProjectDependency 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								import  org.gradle.plugins.ide.eclipse.model.SourceFolder 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-27 07:36:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								apply  plugin:  "propdeps-eclipse" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								apply  plugin:  "propdeps-idea" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-07 06:21:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . jdt  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-29 23:26:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sourceCompatibility  =  1.8 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									targetCompatibility  =  1.8 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-07 06:21:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Replace classpath entries with project dependencies (GRADLE-1116)
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-29 23:26:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// http://issues.gradle.org/browse/GRADLE-1116
 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-27 07:36:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-07 04:56:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									def  regexp  =  /.*?\/ ( [ ^ \ /]+)\/ build \ /[^\/ ] + \ /(?:main|test)/  // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									def  projectOutputDependencies  =  classpath . entries . findAll  {  entry  - >  entry . path  = ~  regexp  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									projectOutputDependencies . each  {  entry  - > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										def  matcher  =  ( entry . path  = ~  regexp ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 20:35:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( matcher )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-07 04:56:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											def  projectName  =  matcher [ 0 ] [ 1 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											def  path  =  "/${projectName}" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( ! classpath . entries . find  {  e  - >  e  instanceof  ProjectDependency  & &  e . path  = =  path  } )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												def  dependency  =  new  ProjectDependency ( path ,  project ( ":${projectName}" ) . path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dependency . exported  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												classpath . entries . add ( dependency ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											classpath . entries . remove ( entry ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									classpath . entries . removeAll  {  entry  - >  ( entry . path  = ~  /(?!.*?repack.*\.jar).*?\/ ( [ ^ \ /]+)\/ build \ /libs\/ [ ^ \ /]+\.jar/ )  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// Use separate main/test outputs (prevents WTP from packaging test classes)
 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 01:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . classpath . defaultOutputDir  =  file ( project . name + "/bin/eclipse" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 02:25:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . beforeMerged  {  classpath  - > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									classpath . entries . findAll {  it  instanceof  SourceFolder  } . each  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 01:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( it . output . startsWith ( "bin/" ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 02:25:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											it . output  =  null 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									classpath . entries . findAll {  it  instanceof  SourceFolder  } . each  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 01:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										it . output  =  "bin/"  +  it . path . split ( "/" ) [ 1 ] 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Ensure project dependencies come after 3rd-party libs (SPR-11836)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// https://jira.spring.io/browse/SPR-11836
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 20:35:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									classpath . entries . findAll  {  it  instanceof  ProjectDependency  } . each  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// delete from original position
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 20:35:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										classpath . entries . remove ( it ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// append to end of classpath
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 20:35:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										classpath . entries . add ( it ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-12-13 21:37:50 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Allow projects to be used as WTP modules
 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . project . natures  "org.eclipse.wst.common.project.facet.core.nature" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// Include project specific settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								task  eclipseSettings ( type:  Copy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									from  rootProject . files ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										"src/eclipse/org.eclipse.jdt.ui.prefs" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										"src/eclipse/org.eclipse.wst.common.project.facet.core.xml" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									into  project . file ( '.settings/' ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 03:42:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									outputs . upToDateWhen  {  false  } 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								task  eclipseWstComponent ( type:  Copy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									from  rootProject . files ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										"src/eclipse/org.eclipse.wst.common.component" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									into  project . file ( '.settings/' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									expand ( deployname:  project . name ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 03:42:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									outputs . upToDateWhen  {  false  } 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								task  eclipseJdtPrepare ( type:  Copy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									from  rootProject . file ( "src/eclipse/org.eclipse.jdt.core.prefs" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									into  project . file ( ".settings/" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 03:42:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									outputs . upToDateWhen  {  false  } 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								task  cleanEclipseJdtUi ( type:  Delete )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-09 01:32:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									delete  project . file ( ".settings/org.eclipse.jdt.core.prefs" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 03:42:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									delete  project . file ( ".settings/org.eclipse.jdt.ui.prefs" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									delete  project . file ( ".settings/org.eclipse.wst.common.component" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									delete  project . file ( ".settings/org.eclipse.wst.common.project.facet.core.xml" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								tasks [ "eclipseJdt" ] . dependsOn ( eclipseJdtPrepare ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								tasks [ "cleanEclipse" ] . dependsOn ( cleanEclipseJdtUi ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								tasks [ "eclipse" ] . dependsOn ( eclipseSettings ,  eclipseWstComponent ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// Filter 'build' folder
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								eclipse . project . file . withXml  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									def  node  =  it . asNode ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									def  filteredResources  =  node . get ( "filteredResources" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( filteredResources )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										node . remove ( filteredResources ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									def  filterNode  =  node . appendNode ( "filteredResources" ) . appendNode ( "filter" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 01:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									filterNode . appendNode ( "id" ,  "1359048889071" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									filterNode . appendNode ( "name" ,  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									filterNode . appendNode ( "type" ,  "30" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									def  matcherNode  =  filterNode . appendNode ( "matcher" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									matcherNode . appendNode ( "id" ,  "org.eclipse.ui.ide.multiFilter" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 01:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matcherNode . appendNode ( "arguments" ,  "1.0-projectRelativePath-matches-false-false-build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}