diff --git a/.idea/artifacts/jps_plugins.xml b/.idea/artifacts/jps_plugins.xml
index fee03eee74f7..ef658048f36c 100644
--- a/.idea/artifacts/jps_plugins.xml
+++ b/.idea/artifacts/jps_plugins.xml
@@ -4,7 +4,6 @@
-
diff --git a/.idea/artifacts/jps_sources.xml b/.idea/artifacts/jps_sources.xml
index 2cd42352db97..2b7c6fd1e0b7 100644
--- a/.idea/artifacts/jps_sources.xml
+++ b/.idea/artifacts/jps_sources.xml
@@ -6,7 +6,6 @@
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
index c95d45fbe908..9e15d0263725 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -60,7 +60,6 @@
-
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java
index 3681465f1778..ffbcdd9586d9 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java
@@ -17,6 +17,7 @@ package com.intellij.compiler;
import com.intellij.ProjectTopics;
import com.intellij.application.options.PathMacrosImpl;
+import com.intellij.compiler.server.impl.CompileServerClasspathManager;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.OSProcessHandler;
@@ -99,6 +100,7 @@ public class CompileServerManager implements ApplicationComponent{
private final ProjectManager myProjectManager;
private static final int MAKE_TRIGGER_DELAY = 5 * 1000 /*5 seconds*/;
private final Map myAutomakeFutures = new HashMap();
+ private final CompileServerClasspathManager myClasspathManager = new CompileServerClasspathManager();
public CompileServerManager(final ProjectManager projectManager) {
myProjectManager = projectManager;
@@ -595,6 +597,7 @@ public class CompileServerManager implements ApplicationComponent{
cmdLine.addParameter("-classpath");
final List cp = ClasspathBootstrap.getCompileServerApplicationClasspath();
+ cp.addAll(myClasspathManager.getCompileServerPluginsClasspath());
cmdLine.addParameter(classpathToString(cp));
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java b/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java
new file mode 100644
index 000000000000..8a1775d27ab9
--- /dev/null
+++ b/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java
@@ -0,0 +1,37 @@
+package com.intellij.compiler.server;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.extensions.PluginAware;
+import com.intellij.openapi.extensions.PluginDescriptor;
+import com.intellij.util.xmlb.annotations.Attribute;
+
+/**
+ * @author nik
+ */
+public class CompileServerPlugin implements PluginAware {
+ public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.compileServer.plugin");
+ private PluginDescriptor myPluginDescriptor;
+ private String myJarPath;
+
+ /**
+ * Specifies path to a jar file which should be added to the classpath of the compile server. The path is relative to the plugin 'lib' directory.
+ * In the development node the name of this file without extension is treated as a module name and the output directory of the module is added to the classpath.
+ */
+ @Attribute("jar-path")
+ public String getJarPath() {
+ return myJarPath;
+ }
+
+ public void setJarPath(String jarPath) {
+ myJarPath = jarPath;
+ }
+
+ @Override
+ public final void setPluginDescriptor(PluginDescriptor pluginDescriptor) {
+ myPluginDescriptor = pluginDescriptor;
+ }
+
+ public PluginDescriptor getPluginDescriptor() {
+ return myPluginDescriptor;
+ }
+}
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/impl/CompileServerClasspathManager.java b/java/compiler/impl/src/com/intellij/compiler/server/impl/CompileServerClasspathManager.java
new file mode 100644
index 000000000000..f1bd0abfc030
--- /dev/null
+++ b/java/compiler/impl/src/com/intellij/compiler/server/impl/CompileServerClasspathManager.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.compiler.server.impl;
+
+import com.intellij.compiler.server.CompileServerPlugin;
+import com.intellij.ide.plugins.IdeaPluginDescriptor;
+import com.intellij.ide.plugins.PluginManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.PluginId;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.util.PathUtil;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public class CompileServerClasspathManager {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.impl.CompileServerClasspathManager");
+ private List myCompileServerPluginsClasspath;
+
+ public List getCompileServerPluginsClasspath() {
+ if (myCompileServerPluginsClasspath == null) {
+ myCompileServerPluginsClasspath = computeCompileServerPluginsClasspath();
+ }
+ return myCompileServerPluginsClasspath;
+ }
+
+ private static List computeCompileServerPluginsClasspath() {
+ final List classpath = new ArrayList();
+ for (CompileServerPlugin serverPlugin : CompileServerPlugin.EP_NAME.getExtensions()) {
+ final PluginId pluginId = serverPlugin.getPluginDescriptor().getPluginId();
+ final IdeaPluginDescriptor plugin = PluginManager.getPlugin(pluginId);
+ LOG.assertTrue(plugin != null, pluginId);
+ final File baseFile = plugin.getPath();
+ if (baseFile.isFile()) {
+ classpath.add(baseFile);
+ }
+ else if (baseFile.isDirectory()) {
+ final String relativePath = serverPlugin.getJarPath();
+ File jarFile = new File(new File(baseFile, "lib"), relativePath);
+ if (jarFile.exists()) {
+ classpath.add(jarFile);
+ }
+ else {
+ //development mode: add directory out/classes/production/ to classpath, assuming that jar-name is equal to module name
+ final String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(relativePath));
+ final File dir = new File(baseFile.getParentFile(), moduleName);
+ if (!dir.exists()) {
+ LOG.warn("Cannot add plugin " + pluginId + " to compile server classpath: " + jarFile.getAbsolutePath() + " and " +
+ dir.getAbsolutePath() + " don't exist");
+ }
+ classpath.add(dir);
+ }
+ }
+ }
+ return classpath;
+ }
+}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/server/ClasspathBootstrap.java b/jps/jps-builders/src/org/jetbrains/jps/server/ClasspathBootstrap.java
index d95a41544503..f520c8128d28 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/server/ClasspathBootstrap.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/server/ClasspathBootstrap.java
@@ -82,11 +82,7 @@ public class ClasspathBootstrap {
cp.add(getResourcePath(FileMonitor.class)); // jna-utils.jar
cp.add(getResourcePath(ClassWriter.class)); // asm
cp.add(getResourcePath(org.objectweb.asm.commons.EmptyVisitor.class)); // asm-commons
- final File jpsModel = getResourcePath(MacroExpander.class);
- cp.add(jpsModel); // jps-model
- cp.add(new File(jpsModel.getParentFile(), "jps-javaee"));
- cp.add(new File(jpsModel.getParentFile(), "jps-gwt"));
- cp.add(new File(jpsModel.getParentFile(), "jps-jpa"));
+ cp.add(getResourcePath(MacroExpander.class)); // jps-model
cp.add(getResourcePath(AlienFormFileException.class)); // forms-compiler
cp.add(getResourcePath(GroovyException.class)); // groovy
cp.add(getResourcePath(org.jdom.input.SAXBuilder.class)); // jdom
diff --git a/jps/plugins/gwt/jps-gwt.iml b/jps/plugins/gwt/jps-gwt.iml
index 621daa2f0ea8..704ab03cf56b 100644
--- a/jps/plugins/gwt/jps-gwt.iml
+++ b/jps/plugins/gwt/jps-gwt.iml
@@ -10,7 +10,6 @@
-
diff --git a/jps/plugins/javaee/jps-javaee.iml b/jps/plugins/javaee/jps-javaee.iml
deleted file mode 100644
index d67aceeddab5..000000000000
--- a/jps/plugins/javaee/jps-javaee.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.artifacts.LayoutElementTypeService b/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.artifacts.LayoutElementTypeService
deleted file mode 100644
index 45b2dc247bd9..000000000000
--- a/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.artifacts.LayoutElementTypeService
+++ /dev/null
@@ -1,2 +0,0 @@
-org.jetbrains.jps.javaee.JavaeeFacetResourcesElementType
-org.jetbrains.jps.javaee.JavaeeFacetClassesElementType
\ No newline at end of file
diff --git a/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.idea.FacetTypeService b/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.idea.FacetTypeService
deleted file mode 100644
index 4b60ca861db8..000000000000
--- a/jps/plugins/javaee/src/META-INF/services/org.jetbrains.jps.idea.FacetTypeService
+++ /dev/null
@@ -1,3 +0,0 @@
-org.jetbrains.jps.javaee.WebFacetType
-org.jetbrains.jps.javaee.EjbFacetType
-org.jetbrains.jps.javaee.JavaeeAppFacetType
\ No newline at end of file
diff --git a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/EjbFacetType.groovy b/jps/plugins/javaee/src/org/jetbrains/jps/javaee/EjbFacetType.groovy
deleted file mode 100644
index 96fa9b90232e..000000000000
--- a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/EjbFacetType.groovy
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.jetbrains.jps.javaee
-
-/**
- * @author nik
- */
-class EjbFacetType extends JavaeeFacetTypeBase {
- EjbFacetType() {
- super("ejb")
- }
-}
diff --git a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeAppFacetType.groovy b/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeAppFacetType.groovy
deleted file mode 100644
index 20dff7d7e44d..000000000000
--- a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeAppFacetType.groovy
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.jetbrains.jps.javaee
-
-/**
- * @author nik
- */
-public class JavaeeAppFacetType extends JavaeeFacetTypeBase {
- JavaeeAppFacetType() {
- super("javaeeApplication")
- }
-}
diff --git a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeFacet.groovy b/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeFacet.groovy
deleted file mode 100644
index 844d2108deda..000000000000
--- a/jps/plugins/javaee/src/org/jetbrains/jps/javaee/JavaeeFacet.groovy
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.jetbrains.jps.javaee
-
-import org.jetbrains.jps.idea.Facet
-
-/**
- * @author nik
- */
-class JavaeeFacet extends Facet {
- final List