// Java API dependencies that may complete the classpath container must
// be declared BEFORE all other dependencies so that container access rules don't fail
// ----------------------------------------------------------------------
IdeDependency[] depsToWrite = config.getDeps();
for (int j = 0; j < depsToWrite.length; j++) {
IdeDependency dep = depsToWrite[j];
if (dep.isJavaApi()) {
String depId = getDependencyId(dep);
if (!addedDependencies.contains(depId)) {
addDependency(writer, dep);
addedDependencies.add(depId);
}
}
}
if (!config.isClasspathContainersLast()) {
writeClasspathContainers(writer);
}
// ----------------------------------------------------------------------
// The project's dependencies
// ----------------------------------------------------------------------
for (int j = 0; j < depsToWrite.length; j++) {
IdeDependency dep = depsToWrite[j];
if (dep.isAddedToClasspath()) {
String depId = getDependencyId(dep);
/* avoid duplicates in the classpath for artifacts with different types (like ejbs or test-jars) */
if (!addedDependencies.contains(depId)) {
addDependency(writer, dep);
addedDependencies.add(depId);