1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.apache.maven.plugin.eclipse.reader; |
15 | |
|
16 | |
import java.io.DataInputStream; |
17 | |
import java.io.File; |
18 | |
import java.io.FileInputStream; |
19 | |
import java.io.FileNotFoundException; |
20 | |
import java.io.FileReader; |
21 | |
import java.io.IOException; |
22 | |
import java.io.StringReader; |
23 | |
import java.text.MessageFormat; |
24 | |
import java.util.ArrayList; |
25 | |
import java.util.HashMap; |
26 | |
import java.util.Iterator; |
27 | |
import java.util.Map; |
28 | |
import java.util.Properties; |
29 | |
import java.util.Set; |
30 | |
import java.util.jar.JarFile; |
31 | |
|
32 | |
import org.apache.maven.plugin.eclipse.WorkspaceConfiguration; |
33 | |
import org.apache.maven.plugin.ide.IdeDependency; |
34 | |
import org.apache.maven.plugin.ide.IdeUtils; |
35 | |
import org.apache.maven.plugin.logging.Log; |
36 | |
import org.apache.maven.project.MavenProject; |
37 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
38 | |
import org.codehaus.plexus.util.xml.Xpp3DomBuilder; |
39 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
40 | |
import org.eclipse.core.internal.localstore.SafeChunkyInputStream; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | 0 | public class ReadWorkspaceLocations |
49 | |
{ |
50 | |
|
51 | |
private static final String BINARY_LOCATION_FILE = ".location"; |
52 | |
|
53 | |
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS = |
54 | |
".metadata/.plugins/org.eclipse.core.resources/.projects"; |
55 | |
|
56 | 0 | private static final String[] PARENT_VERSION = new String[] { "parent", "version" }; |
57 | |
|
58 | 0 | private static final String[] PARENT_GROUP_ID = new String[] { "parent", "groupId" }; |
59 | |
|
60 | 0 | private static final String[] PACKAGING = new String[] { "packaging" }; |
61 | |
|
62 | 0 | private static final String[] VERSION = new String[] { "version" }; |
63 | |
|
64 | 0 | private static final String[] GROUP_ID = new String[] { "groupId" }; |
65 | |
|
66 | 0 | private static final String[] ARTEFACT_ID = new String[] { "artifactId" }; |
67 | |
|
68 | |
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS = |
69 | |
".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs"; |
70 | |
|
71 | |
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY = |
72 | |
"org.eclipse.jdt.launching.PREF_VM_XML"; |
73 | |
|
74 | |
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS = |
75 | |
".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs"; |
76 | |
|
77 | |
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY = "runtimes"; |
78 | |
|
79 | |
private static final String CLASSPATHENTRY_DEFAULT = "org.eclipse.jdt.launching.JRE_CONTAINER"; |
80 | |
|
81 | |
private static final String CLASSPATHENTRY_STANDARD = |
82 | |
CLASSPATHENTRY_DEFAULT + "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/"; |
83 | |
|
84 | |
private static final String CLASSPATHENTRY_FORMAT = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT + "/{0}/{1}"; |
85 | |
|
86 | |
public void init( Log log, WorkspaceConfiguration workspaceConfiguration, MavenProject project, |
87 | |
String wtpDefaultServer ) |
88 | |
{ |
89 | 0 | detectDefaultJREContaigner( workspaceConfiguration, project, log ); |
90 | 0 | readWorkspace( workspaceConfiguration, log ); |
91 | 0 | detectWTPDefaultServer( log, workspaceConfiguration, wtpDefaultServer ); |
92 | 0 | } |
93 | |
|
94 | |
private void detectWTPDefaultServer( Log log, WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer ) |
95 | |
{ |
96 | 0 | HashMap servers = readDefinedServers( workspaceConfiguration, log ); |
97 | 0 | if ( wtpDefaultServer != null ) |
98 | |
{ |
99 | 0 | Set ids = servers.keySet(); |
100 | |
|
101 | 0 | Iterator idIterator = ids.iterator(); |
102 | 0 | while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() ) |
103 | |
{ |
104 | 0 | String id = (String) idIterator.next(); |
105 | 0 | String name = (String) servers.get( id ); |
106 | 0 | if ( wtpDefaultServer.equals( id ) || wtpDefaultServer.equals( name ) ) |
107 | |
{ |
108 | 0 | workspaceConfiguration.setDefaultDeployServerId( id ); |
109 | 0 | workspaceConfiguration.setDefaultDeployServerName( name ); |
110 | |
} |
111 | 0 | } |
112 | 0 | if ( workspaceConfiguration.getDefaultDeployServerId() == null ) |
113 | |
{ |
114 | 0 | log.info( "no exact wtp server match." ); |
115 | |
|
116 | 0 | idIterator = ids.iterator(); |
117 | 0 | while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() ) |
118 | |
{ |
119 | 0 | String id = (String) idIterator.next(); |
120 | 0 | String name = (String) servers.get( id ); |
121 | 0 | if ( id.indexOf( wtpDefaultServer ) >= 0 || name.indexOf( wtpDefaultServer ) >= 0 ) |
122 | |
{ |
123 | 0 | workspaceConfiguration.setDefaultDeployServerId( id ); |
124 | 0 | workspaceConfiguration.setDefaultDeployServerName( name ); |
125 | |
} |
126 | 0 | } |
127 | |
} |
128 | |
} |
129 | 0 | if ( workspaceConfiguration.getDefaultDeployServerId() == null && servers.size() > 0 ) |
130 | |
{ |
131 | |
|
132 | 0 | log.info( "no substring wtp server match." ); |
133 | 0 | workspaceConfiguration.setDefaultDeployServerId( (String) servers.get( "" ) ); |
134 | 0 | workspaceConfiguration.setDefaultDeployServerName( (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) ); |
135 | |
} |
136 | 0 | log.info( "Using as WTP server : " + workspaceConfiguration.getDefaultDeployServerName() ); |
137 | 0 | } |
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
private String getContaignerFromExecutable( String rawExecutable, Map jreMap, Log logger ) |
148 | |
{ |
149 | 0 | String foundContaigner = null; |
150 | 0 | if ( rawExecutable != null ) |
151 | |
{ |
152 | |
String executable; |
153 | |
try |
154 | |
{ |
155 | 0 | executable = new File( rawExecutable ).getCanonicalPath(); |
156 | 0 | logger.debug( "detected executable: " + executable ); |
157 | |
} |
158 | 0 | catch ( Exception e ) |
159 | |
{ |
160 | 0 | return null; |
161 | 0 | } |
162 | 0 | File executableFile = new File( executable ); |
163 | 0 | while ( executableFile != null ) |
164 | |
{ |
165 | 0 | foundContaigner = (String) jreMap.get( executableFile.getPath() ); |
166 | 0 | if ( foundContaigner != null ) |
167 | |
{ |
168 | 0 | logger.debug( "detected classpathContaigner from executable: " + foundContaigner ); |
169 | 0 | return foundContaigner; |
170 | |
|
171 | |
} |
172 | 0 | executableFile = executableFile.getParentFile(); |
173 | |
} |
174 | |
} |
175 | 0 | return null; |
176 | |
} |
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
private void detectDefaultJREContaigner( WorkspaceConfiguration workspaceConfiguration, MavenProject project, |
186 | |
Log logger ) |
187 | |
{ |
188 | 0 | String defaultJREContainer = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT; |
189 | 0 | if ( workspaceConfiguration.getWorkspaceDirectory() != null ) |
190 | |
{ |
191 | 0 | Map jreMap = readAvailableJREs( workspaceConfiguration.getWorkspaceDirectory(), logger ); |
192 | 0 | if ( jreMap != null ) |
193 | |
{ |
194 | 0 | String foundContaigner = |
195 | |
getContaignerFromExecutable( System.getProperty( "maven.compiler.executable" ), jreMap, logger ); |
196 | 0 | if ( foundContaigner == null ) |
197 | |
{ |
198 | 0 | foundContaigner = |
199 | |
getContaignerFromExecutable( IdeUtils.getCompilerPluginSetting( project, "executable" ), |
200 | |
jreMap, logger ); |
201 | |
} |
202 | 0 | if ( foundContaigner == null ) |
203 | |
{ |
204 | 0 | String sourceVersion = IdeUtils.getCompilerSourceVersion( project ); |
205 | 0 | foundContaigner = (String) jreMap.get( sourceVersion ); |
206 | 0 | if ( foundContaigner != null ) |
207 | |
{ |
208 | 0 | logger.debug( "detected classpathContaigner from sourceVersion(" + sourceVersion + "): " + |
209 | |
foundContaigner ); |
210 | |
} |
211 | |
} |
212 | 0 | if ( foundContaigner == null ) |
213 | |
{ |
214 | 0 | foundContaigner = getContaignerFromExecutable( System.getProperty( "java.home" ), jreMap, logger ); |
215 | |
} |
216 | 0 | if ( foundContaigner != null ) |
217 | |
{ |
218 | 0 | defaultJREContainer = foundContaigner; |
219 | |
} |
220 | |
|
221 | |
} |
222 | |
} |
223 | 0 | workspaceConfiguration.setDefaultClasspathContainer( defaultJREContainer ); |
224 | 0 | } |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
private String getProjectLocation( File workspaceLocation, File project ) |
234 | |
{ |
235 | 0 | String projectLocation = null; |
236 | 0 | File location = new File( project, ReadWorkspaceLocations.BINARY_LOCATION_FILE ); |
237 | 0 | if ( location.exists() ) |
238 | |
{ |
239 | |
try |
240 | |
{ |
241 | 0 | SafeChunkyInputStream fileInputStream = new SafeChunkyInputStream( location ); |
242 | 0 | DataInputStream dataInputStream = new DataInputStream( fileInputStream ); |
243 | 0 | String file = dataInputStream.readUTF().trim(); |
244 | |
|
245 | 0 | if ( file.length() > 0 ) |
246 | |
{ |
247 | 0 | file = file.substring( file.indexOf( ':' ) + 1 ); |
248 | 0 | while ( !Character.isLetterOrDigit( file.charAt( 0 ) ) ) |
249 | |
{ |
250 | 0 | file = file.substring( 1 ); |
251 | |
} |
252 | 0 | if ( file.indexOf( ':' ) < 0 ) |
253 | |
{ |
254 | 0 | file = File.separator + file; |
255 | |
} |
256 | 0 | projectLocation = file; |
257 | |
} |
258 | |
|
259 | |
} |
260 | 0 | catch ( FileNotFoundException e ) |
261 | |
{ |
262 | 0 | projectLocation = "unknown"; |
263 | |
} |
264 | 0 | catch ( IOException e ) |
265 | |
{ |
266 | 0 | projectLocation = "unknown"; |
267 | 0 | } |
268 | |
} |
269 | 0 | if ( projectLocation == null ) |
270 | |
{ |
271 | 0 | File projectBase = new File( workspaceLocation, project.getName() ); |
272 | 0 | if ( projectBase.isDirectory() ) |
273 | |
{ |
274 | 0 | projectLocation = projectBase.getAbsolutePath(); |
275 | |
} |
276 | |
} |
277 | 0 | return projectLocation; |
278 | |
} |
279 | |
|
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
private String getValue( Xpp3Dom element, String[] elementNames, String defaultValue ) |
289 | |
{ |
290 | 0 | String value = null; |
291 | 0 | Xpp3Dom dom = element; |
292 | 0 | for ( int index = 0; dom != null && index < elementNames.length; index++ ) |
293 | |
{ |
294 | 0 | dom = dom.getChild( elementNames[index] ); |
295 | |
} |
296 | 0 | if ( dom != null ) |
297 | |
{ |
298 | 0 | value = dom.getValue(); |
299 | |
} |
300 | 0 | if ( value == null || value.trim().length() == 0 ) |
301 | |
{ |
302 | 0 | return defaultValue; |
303 | |
} |
304 | |
else |
305 | |
{ |
306 | 0 | return value; |
307 | |
} |
308 | |
} |
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
private IdeDependency readArtefact( String projectLocation, Log logger ) |
322 | |
throws FileNotFoundException, XmlPullParserException, IOException |
323 | |
{ |
324 | 0 | File projectFile = new File( new File( projectLocation ), ".project" ); |
325 | 0 | String eclipseProjectName = new File( projectLocation ).getName(); |
326 | 0 | if ( projectFile.exists() ) |
327 | |
{ |
328 | 0 | Xpp3Dom project = Xpp3DomBuilder.build( new FileReader( projectFile ) ); |
329 | 0 | eclipseProjectName = getValue( project, new String[] { "name" }, eclipseProjectName ); |
330 | |
} |
331 | 0 | File pomFile = new File( new File( projectLocation ), "pom.xml" ); |
332 | 0 | if ( pomFile.exists() ) |
333 | |
{ |
334 | 0 | Xpp3Dom pom = Xpp3DomBuilder.build( new FileReader( pomFile ) ); |
335 | |
|
336 | 0 | String artifact = getValue( pom, ReadWorkspaceLocations.ARTEFACT_ID, null ); |
337 | 0 | String group = |
338 | |
getValue( pom, ReadWorkspaceLocations.GROUP_ID, getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID, |
339 | |
null ) ); |
340 | 0 | String version = |
341 | |
getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, ReadWorkspaceLocations.PARENT_VERSION, |
342 | |
null ) ); |
343 | 0 | String packaging = getValue( pom, ReadWorkspaceLocations.PACKAGING, "jar" ); |
344 | |
|
345 | 0 | logger.debug( "found workspace artefact " + group + ":" + artifact + ":" + version + " " + packaging + |
346 | |
" (" + eclipseProjectName + ")" + " -> " + projectLocation ); |
347 | 0 | return new IdeDependency( group, artifact, version, packaging, true, false, false, false, false, null, |
348 | |
packaging, false, null, 0, eclipseProjectName ); |
349 | |
} |
350 | |
else |
351 | |
{ |
352 | 0 | logger.debug( "ignored workspace project NO pom available " + projectLocation ); |
353 | 0 | return null; |
354 | |
} |
355 | |
} |
356 | |
|
357 | |
private HashMap readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger ) |
358 | |
{ |
359 | 0 | HashMap detectedRuntimes = new HashMap(); |
360 | 0 | if ( workspaceConfiguration.getWorkspaceDirectory() != null ) |
361 | |
{ |
362 | 0 | Xpp3Dom runtimesElement = null; |
363 | |
try |
364 | |
{ |
365 | 0 | File prefs = |
366 | |
new File( workspaceConfiguration.getWorkspaceDirectory(), |
367 | |
ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS ); |
368 | 0 | Properties properties = new Properties(); |
369 | 0 | properties.load( new FileInputStream( prefs ) ); |
370 | 0 | runtimesElement = |
371 | |
Xpp3DomBuilder.build( new StringReader( |
372 | |
properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY ) ) ); |
373 | |
} |
374 | 0 | catch ( Exception e ) |
375 | |
{ |
376 | 0 | logger.error( "Could not read workspace wtp server runtimes preferences : " + e.getMessage() ); |
377 | 0 | } |
378 | |
|
379 | 0 | if ( runtimesElement != null ) |
380 | |
{ |
381 | 0 | Xpp3Dom[] runtimeArray = runtimesElement.getChildren( "runtime" ); |
382 | 0 | for ( int index = 0; runtimeArray != null && index < runtimeArray.length; index++ ) |
383 | |
{ |
384 | 0 | String id = runtimeArray[index].getAttribute( "id" ); |
385 | 0 | String name = runtimeArray[index].getAttribute( "name" ); |
386 | 0 | if ( detectedRuntimes.isEmpty() ) |
387 | |
{ |
388 | 0 | logger.debug( "Using WTP runtime with id: \"" + id + "\" as default runtime" ); |
389 | 0 | detectedRuntimes.put( "", id ); |
390 | |
} |
391 | 0 | detectedRuntimes.put( id, name ); |
392 | 0 | logger.debug( "Detected WTP runtime with id: \"" + id + "\" and name: \"" + name + "\"" ); |
393 | |
} |
394 | |
} |
395 | |
} |
396 | 0 | return detectedRuntimes; |
397 | |
} |
398 | |
|
399 | |
|
400 | |
|
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
|
407 | |
private HashMap readAvailableJREs( File workspaceLocation, Log logger ) |
408 | |
{ |
409 | 0 | HashMap jreMap = new HashMap(); |
410 | 0 | jreMap.put( "1.2", CLASSPATHENTRY_STANDARD + "J2SE-1.2" ); |
411 | 0 | jreMap.put( "1.3", CLASSPATHENTRY_STANDARD + "J2SE-1.3" ); |
412 | 0 | jreMap.put( "1.4", CLASSPATHENTRY_STANDARD + "J2SE-1.4" ); |
413 | 0 | jreMap.put( "1.5", CLASSPATHENTRY_STANDARD + "J2SE-1.5" ); |
414 | 0 | jreMap.put( "5", jreMap.get( "1.5" ) ); |
415 | 0 | jreMap.put( "1.6", CLASSPATHENTRY_STANDARD + "JavaSE-1.6" ); |
416 | 0 | jreMap.put( "6", jreMap.get( "1.6" ) ); |
417 | |
Xpp3Dom vms; |
418 | |
try |
419 | |
{ |
420 | 0 | File prefs = |
421 | |
new File( workspaceLocation, |
422 | |
ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS ); |
423 | 0 | if ( !prefs.exists() ) |
424 | |
{ |
425 | 0 | return jreMap; |
426 | |
} |
427 | 0 | Properties properties = new Properties(); |
428 | 0 | properties.load( new FileInputStream( prefs ) ); |
429 | 0 | vms = |
430 | |
Xpp3DomBuilder.build( new StringReader( |
431 | |
properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY ) ) ); |
432 | |
} |
433 | 0 | catch ( Exception e ) |
434 | |
{ |
435 | 0 | logger.error( "Could not read workspace JRE preferences", e ); |
436 | 0 | return jreMap; |
437 | 0 | } |
438 | 0 | String defaultJRE = vms.getAttribute( "defaultVM" ).trim(); |
439 | 0 | Xpp3Dom[] vmTypes = vms.getChildren( "vmType" ); |
440 | 0 | for ( int vmTypeIndex = 0; vmTypeIndex < vmTypes.length; vmTypeIndex++ ) |
441 | |
{ |
442 | 0 | String typeId = vmTypes[vmTypeIndex].getAttribute( "id" ); |
443 | 0 | Xpp3Dom[] vm = vmTypes[vmTypeIndex].getChildren( "vm" ); |
444 | 0 | for ( int vmIndex = 0; vmIndex < vm.length; vmIndex++ ) |
445 | |
{ |
446 | |
try |
447 | |
{ |
448 | 0 | String path = vm[vmIndex].getAttribute( "path" ); |
449 | 0 | String name = vm[vmIndex].getAttribute( "name" ); |
450 | 0 | String vmId = vm[vmIndex].getAttribute( "id" ).trim(); |
451 | 0 | String classpathEntry = |
452 | |
MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT, |
453 | |
new Object[] { typeId, name } ); |
454 | 0 | String jrePath = new File( path ).getCanonicalPath(); |
455 | 0 | JarFile rtJar = new JarFile( new File( new File( jrePath ), "jre/lib/rt.jar" ) ); |
456 | 0 | String version = rtJar.getManifest().getMainAttributes().getValue( "Specification-Version" ); |
457 | 0 | if ( defaultJRE.endsWith( "," + vmId ) ) |
458 | |
{ |
459 | 0 | jreMap.put( jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT ); |
460 | 0 | jreMap.put( version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT ); |
461 | 0 | logger.debug( "Default Classpath Contaigner version: " + version + " location: " + jrePath ); |
462 | |
} |
463 | 0 | else if ( !jreMap.containsKey( jrePath ) ) |
464 | |
{ |
465 | 0 | if ( !jreMap.containsKey( version ) ) |
466 | |
{ |
467 | 0 | jreMap.put( version, classpathEntry ); |
468 | |
} |
469 | 0 | jreMap.put( jrePath, classpathEntry ); |
470 | 0 | logger.debug( "Additional Classpath Contaigner version: " + version + " " + classpathEntry + |
471 | |
" location: " + jrePath ); |
472 | |
} |
473 | |
else |
474 | |
{ |
475 | 0 | logger.debug( "Ignored (duplicated) additional Classpath Contaigner version: " + version + " " + |
476 | |
classpathEntry + " location: " + jrePath ); |
477 | |
} |
478 | |
} |
479 | 0 | catch ( IOException e ) |
480 | |
{ |
481 | 0 | logger.warn( "Could not interpret entry: " + vm.toString() ); |
482 | 0 | } |
483 | |
} |
484 | |
} |
485 | 0 | return jreMap; |
486 | |
} |
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
private void readWorkspace( WorkspaceConfiguration workspaceConfiguration, Log logger ) |
495 | |
{ |
496 | 0 | ArrayList dependencys = new ArrayList(); |
497 | 0 | if ( workspaceConfiguration.getWorkspaceDirectory() != null ) |
498 | |
{ |
499 | 0 | File workspace = |
500 | |
new File( workspaceConfiguration.getWorkspaceDirectory(), |
501 | |
ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS ); |
502 | |
|
503 | 0 | File[] directories = workspace.listFiles(); |
504 | 0 | for ( int index = 0; directories != null && index < directories.length; index++ ) |
505 | |
{ |
506 | 0 | File project = directories[index]; |
507 | 0 | if ( project.isDirectory() ) |
508 | |
{ |
509 | |
try |
510 | |
{ |
511 | 0 | String projectLocation = |
512 | |
getProjectLocation( workspaceConfiguration.getWorkspaceDirectory(), project ); |
513 | 0 | if ( projectLocation != null ) |
514 | |
{ |
515 | 0 | IdeDependency ideDependency = readArtefact( projectLocation, logger ); |
516 | 0 | if ( ideDependency != null ) |
517 | |
{ |
518 | 0 | dependencys.add( ideDependency ); |
519 | |
} |
520 | |
} |
521 | |
} |
522 | 0 | catch ( Exception e ) |
523 | |
{ |
524 | 0 | logger.warn( "could not read workspace project:" + project ); |
525 | 0 | } |
526 | |
} |
527 | |
} |
528 | |
} |
529 | 0 | workspaceConfiguration.setWorkspaceArtefacts( (IdeDependency[]) dependencys.toArray( new IdeDependency[dependencys.size()] ) ); |
530 | 0 | } |
531 | |
} |