2023-10-29 18:55:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								import  org.gradle.plugins.ide.eclipse.model.Library 
							 
						 
					
						
							
								
									
										
										
										
											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 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								apply  plugin:  'eclipse' 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-07 06:21:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . jdt  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-22 22:22:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sourceCompatibility  =  17 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									targetCompatibility  =  17 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-04 21:32:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									javaRuntimeName  =  "JavaSE-17" 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-07 06:21:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Replace classpath entries with project dependencies (GRADLE-1116)
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 06:21:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// https://issues.gradle.org/browse/GRADLE-1116
 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-27 07:36:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-23 05:16:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									def  regexp  =  /.*?\/ ( [ ^ \ /]+)\/ build \ /([^\/ ] + \ /)+(?:main|test)/  // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-07 04:56:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									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}" 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:05:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! classpath . entries . find  {  e  - >  e  instanceof  ProjectDependency  & &  e . path  = =  path  } )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:58:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												def  recursiveDependency  =  entry . path . matches ( '.+/'  +  projectName  +  '/build/([^/]+/)+(?:main|test)' ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:05:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Avoid recursive dependency on current project.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:58:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( ! recursiveDependency )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													classpath . entries . add ( new  ProjectDependency ( path ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:05:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-07 04:56:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											classpath . entries . remove ( entry ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:58:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Remove any remaining direct depencencies on JARs in the build/libs folder
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 17:38:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// except the repack JARs.
 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-07 04:56:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									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)
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +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  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( it . output . startsWith ( 'bin/' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 02:25:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											it . output  =  null 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:42:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									entries . findAll {  it  instanceof  SourceFolder  } . each  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +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
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:42:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									entries . findAll  {  it  instanceof  ProjectDependency  } . each  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// delete from original position
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:42:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										entries . remove ( it ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// append to end of classpath
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:42:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										entries . add ( it ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-30 19:31:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-29 18:25:53 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Remove recursive project dependencies
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									entries . findAll  {  it  instanceof  ProjectDependency  & &  it . path  = =  ( '/'  +  project . name )  } . each  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										entries . remove ( it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-07 23:02:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Remove Java 21 classpath entries, since we currently use Java 17
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// within Eclipse. Consequently, Java 21 features managed via the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// me.champeau.mrjar plugin cannot be built or tested within Eclipse.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-27 23:03:39 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									classpath . entries . removeAll  {  it . path  = ~  /src\/ ( main | test ) \ /java(21|24)/  } 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-07 23:02:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-29 18:55:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Remove classpath entries for non-existent libraries added by the me.champeau.mrjar
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// plugin, such as "spring-core/build/classes/kotlin/java21".
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								eclipse . classpath . file . whenMerged  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									entries . findAll  {  it  instanceof  Library  & &  ! file ( it . path ) . exists ( )  } . each  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										entries . remove ( it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-26 21:39:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Due to an apparent bug in Gradle, even though we exclude the "main" classpath
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// entries for sources generated by XJC in spring-oxm.gradle, the Gradle eclipse
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// plugin still includes them in the generated .classpath file. So, we have to
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// manually remove those lingering "main" entries.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								if  ( project . name  = =  "spring-oxm" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									eclipse . classpath . file . whenMerged  {  classpath  - > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										classpath . entries . removeAll  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											it . path  = ~  /build\/ generated \ /sources\/ xjc \ /.+/  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											it . entryAttributes . get ( "gradle_scope" )  = =  "main" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Include project specific settings
 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-19 16:30:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								tasks . register ( 'eclipseSettings' ,  Copy )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									from  rootProject . files ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:13:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										'src/eclipse/org.eclipse.core.resources.prefs' , 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-21 18:37:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										'src/eclipse/org.eclipse.jdt.core.prefs' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										'src/eclipse/org.eclipse.jdt.ui.prefs' ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									into  project . file ( '.settings/' ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-15 03:42:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									outputs . upToDateWhen  {  false  } 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-19 16:30:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								tasks . register ( 'cleanEclipseSettings' ,  Delete )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:13:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									delete  project . file ( '.settings/org.eclipse.core.resources.prefs' ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 02:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									delete  project . file ( '.settings/org.eclipse.jdt.core.prefs' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									delete  project . file ( '.settings/org.eclipse.jdt.ui.prefs' ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 04:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-21 18:37:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								tasks [ 'eclipse' ] . dependsOn ( eclipseSettings ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								tasks [ 'eclipseJdt' ] . dependsOn ( eclipseSettings ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-15 03:42:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								tasks [ 'cleanEclipse' ] . dependsOn ( cleanEclipseSettings )