Skip to content

Commit

Permalink
[AS7-5927] Minimal AS7 build pulls in many unecessary dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Diesler authored and n1hility committed Dec 1, 2012
1 parent a632df9 commit 3f9cbf4
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 128 deletions.
38 changes: 13 additions & 25 deletions arquillian/container-embedded/pom.xml
Expand Up @@ -101,31 +101,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>java.util.logging.manager</name>
<value>org.jboss.logmanager.LogManager</value>
</property>
<property>
<name>jboss.home</name>
<value>${basedir}/target/jbossas</value>
</property>
<property>
<name>module.path</name>
<value>${jboss.home}/modules</value>
</property>
<property>
<name>bundle.path</name>
<value>${jboss.home}/bundles</value>
</property>
</systemProperties>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${basedir}/target/jbossas</jboss.home>
<module.path>${jboss.home}/modules</module.path>
<bundle.path>${jboss.home}/modules</bundle.path>
</systemPropertyVariables>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
9 changes: 2 additions & 7 deletions build-modular/build-modular-config.xml
Expand Up @@ -44,16 +44,11 @@

<!-- See ServerDependenciesProcessor -->
<property name="common.dependencies" value="
sun.jdk,
ibm.jdk,
javaee.api,
javax.api,
org.jboss.logging,
org.jboss.vfs,
org.apache.commons.logging,
org.apache.log4j,
org.slf4j,
org.jboss.logging.jul-to-slf4j-stub"/>
org.jboss.logging.jul-to-slf4j-stub"
/>

<target name="all" depends="generate-standalone-configs,generate-domain-configs,build-standalone-server,build-domain-server" />

Expand Down
Expand Up @@ -25,11 +25,11 @@
<module xmlns="urn:jboss:module:1.1" name="javax.activation.api">
<dependencies>
<module name="javax.api" />
<module name="javax.mail.api">
<module name="javax.mail.api" optional="true">
<imports><include path="META-INF"/></imports>
</module>
<module name="com.sun.xml.messaging.saaj"/>
<module name="org.jboss.ws.native.jbossws-native-core"/>
<module name="com.sun.xml.messaging.saaj" optional="true"/>
<module name="org.jboss.ws.native.jbossws-native-core" optional="true"/>
<module name="org.apache.cxf" optional="true"/>
</dependencies>

Expand Down
Expand Up @@ -37,10 +37,10 @@
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="javax.xml.ws.api" optional="true"/>
<module name="org.hibernate.validator"/>
<module name="org.hibernate.validator" optional="true"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.naming"/>
<module name="org.jboss.as.naming" optional="true"/>
<module name="org.jboss.as.server" />
<module name="org.jboss.invocation"/>
<module name="org.jboss.jandex"/>
Expand Down
Expand Up @@ -33,9 +33,13 @@

<dependencies>
<module name="javax.ejb.api"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.controller-client"/>
<module name="org.jboss.jandex"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.modules"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
Expand Up @@ -33,7 +33,7 @@

<dependencies>
<module name="javax.api"/>
<module name="org.apache.log4j" />
<module name="org.apache.log4j"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.common-core"/>
Expand Down
Expand Up @@ -34,12 +34,13 @@
<dependencies>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.inject.api"/>
<module name="org.apache.xerces" services="import"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.ee"/>
<module name="org.jboss.jandex"/>
<module name="org.jboss.as.ee" optional="true"/>
<module name="org.jboss.as.network"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.jandex"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.modules"/>
<module name="org.jboss.msc"/>
Expand Down
Expand Up @@ -36,7 +36,7 @@
<dependencies>
<module name="javax.api"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.common-beans" services="export"/>
<module name="org.jboss.common-beans" services="export"/>
<module name="org.jboss.dmr"/>
<module name="org.jboss.invocation"/>
<module name="org.jboss.jandex"/>
Expand All @@ -56,7 +56,6 @@
<module name="org.jboss.as.deployment-repository"/>
<module name="org.jboss.as.domain-http-interface"/>
<module name="org.jboss.as.domain-management"/>
<module name="org.jboss.as.embedded"/>
<module name="org.jboss.as.jmx" services="import"/>
<module name="org.jboss.as.network"/>
<module name="org.jboss.as.platform-mbean"/>
Expand Down
Expand Up @@ -34,15 +34,15 @@
<dependencies>
<module name="javax.annotation.api"/>
<module name="javax.api"/>
<module name="javax.ejb.api"/>
<module name="javax.interceptor.api"/>
<module name="javax.jws.api"/>
<module name="javax.persistence.api"/>
<module name="javax.servlet.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.xml.ws.api"/>
<module name="org.jboss.ejb3"/>
<module name="javax.ejb.api" optional="true"/>
<module name="javax.interceptor.api" optional="true"/>
<module name="javax.jws.api" optional="true"/>
<module name="javax.persistence.api" optional="true"/>
<module name="javax.servlet.api" optional="true"/>
<module name="javax.servlet.jsp.api" optional="true"/>
<module name="javax.xml.bind.api" optional="true"/>
<module name="javax.xml.ws.api" optional="true"/>
<module name="org.jboss.ejb3" optional="true"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.logging"/>
</dependencies>
Expand Down
Expand Up @@ -37,6 +37,7 @@
import javax.xml.stream.XMLStreamWriter;

import org.jboss.as.config.assembly.ModuleParser.ModuleDependency;
import org.jboss.logging.Logger;
import org.jboss.modules.ModuleIdentifier;

/**
Expand All @@ -48,6 +49,8 @@
*/
public class GenerateModulesDefinition {

static Logger log = Logger.getLogger(GenerateModulesDefinition.class);

static final String SPLIT_PATTERN = ",(\\s*)";
static final String SKIP_SUBSYSTEMS = "skip-subsystems";
static final String NO_MODULE_DEPENENCIES = "no-module-dependencies";
Expand Down Expand Up @@ -171,30 +174,30 @@ public int compare(ModuleIdentifier o1, ModuleIdentifier o2) {

private void processModuleDependency(List<ModuleIdentifier> dependencies, ElementNode parentNode, ModuleDependency dep) throws IOException, XMLStreamException {
ModuleIdentifier moduleId = dep.getModuleId();
if (dependencies.contains(moduleId)) {
log.debugf("Already defined: %s", moduleId);
return;
}

ElementNode moduleNode = new ElementNode(parentNode, "module");
moduleNode.addAttribute("name", new AttributeValue(moduleId.toString()));
if (dep.isOptional()) {
moduleNode.addAttribute("optional", new AttributeValue("true"));
}
if (dependencies.contains(moduleId)) {
moduleNode.addAttribute("defined", new AttributeValue("true"));
parentNode.addChild(moduleNode);
} else {
parentNode.addChild(moduleNode);
if (!dep.isOptional()) {
dependencies.add(moduleId);
parentNode.addChild(moduleNode);

String path = moduleId.getName().replace('.', '/') + '/' + moduleId.getSlot();
File moduleFile = new File(resourcesDir + File.separator + "modules" + File.separator + path + File.separator + "module.xml");
if (!dep.isOptional()) {
dependencies.add(moduleId);

ModuleParser moduleParser = new ModuleParser(moduleFile);
moduleParser.parse();
String path = moduleId.getName().replace('.', '/') + '/' + moduleId.getSlot();
File moduleFile = new File(resourcesDir + File.separator + "modules" + File.separator + path + File.separator + "module.xml");

List<ModuleDependency> moduledeps = moduleParser.getDependencies();
for (ModuleDependency aux : moduledeps) {
processModuleDependency(dependencies, moduleNode, aux);
}
ModuleParser moduleParser = new ModuleParser(moduleFile);
moduleParser.parse();

List<ModuleDependency> moduledeps = moduleParser.getDependencies();
for (ModuleDependency aux : moduledeps) {
processModuleDependency(dependencies, moduleNode, aux);
}
} else {
moduleNode.addAttribute("optional", new AttributeValue("true"));
}
}
}
4 changes: 4 additions & 0 deletions embedded/pom.xml
Expand Up @@ -63,6 +63,10 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller-client</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-server</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
Expand Down
Expand Up @@ -32,8 +32,6 @@
import org.jboss.modules.log.JDKModuleLogger;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Properties;
import java.util.logging.LogManager;
Expand Down Expand Up @@ -65,27 +63,7 @@ private EmbeddedServerFactory() {
}

public static StandaloneServer create(final ModuleLoader moduleLoader, final File jbossHomeDir, final Properties systemProps, final Map<String, String> systemEnv) {
try {
// Load the server Module and get its ClassLoader
final ModuleIdentifier serverModuleId = ModuleIdentifier.create("org.jboss.as.server");
final Module serverModule = moduleLoader.loadModule(serverModuleId);
final ModuleClassLoader serverModuleClassLoader = serverModule.getClassLoader();

Class<?> embeddedStandAloneServerFactoryClass = serverModuleClassLoader.loadClass("org.jboss.as.server.EmbeddedStandAloneServerFactory");
Method createMethod = embeddedStandAloneServerFactoryClass.getMethod("create", File.class, ModuleLoader.class, Properties.class, Map.class);
final StandaloneServer standaloneServer = (StandaloneServer) createMethod.invoke(null, jbossHomeDir, moduleLoader, systemProps, systemEnv);
return standaloneServer;
} catch (ModuleLoadException e) {
throw MESSAGES.moduleLoaderError(e, e.getMessage(), moduleLoader);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return EmbeddedStandAloneServerFactory.create(jbossHomeDir, moduleLoader, systemProps, systemEnv);
}

public static StandaloneServer create(final File jbossHomeDir, final Properties systemProps, final Map<String, String> systemEnv, String...systemPackages) {
Expand Down
Expand Up @@ -20,12 +20,8 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.server;
package org.jboss.as.embedded;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
Expand All @@ -45,20 +41,28 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.jboss.as.controller.extension.ExtensionRegistry;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;

import org.jboss.as.controller.ModelController;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.controller.extension.ExtensionRegistry;
import org.jboss.as.controller.parsing.Namespace;
import org.jboss.as.server.parsing.StandaloneXml;
import org.jboss.as.controller.persistence.ExtensibleConfigurationPersister;
import org.jboss.as.controller.persistence.TransientConfigurationPersister;
import org.jboss.as.embedded.ServerStartException;
import org.jboss.as.embedded.StandaloneServer;
import org.jboss.as.protocol.StreamUtils;
import org.jboss.as.server.Bootstrap;
import org.jboss.as.server.Main;
import org.jboss.as.server.ServerEnvironment;
import org.jboss.as.server.ServerMessages;
import org.jboss.as.server.Services;
import org.jboss.as.server.deployment.client.ModelControllerServerDeploymentManager;
import org.jboss.as.server.parsing.StandaloneXml;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleLoader;
import org.jboss.msc.service.ServiceActivator;
Expand Down Expand Up @@ -225,7 +229,7 @@ public void undeploy(File file) throws ExecutionException, InterruptedException
return standaloneServer;
}

public static void setupCleanDirectories(Properties props) {
static void setupCleanDirectories(Properties props) {
File jbossHomeDir = new File(props.getProperty(ServerEnvironment.HOME_DIR));
setupCleanDirectories(jbossHomeDir, props);
}
Expand Down
Expand Up @@ -19,16 +19,18 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.server;
package org.jboss.as.embedded;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.jboss.as.server.ServerEnvironment;

import java.io.File;
import java.io.IOException;
import java.util.Properties;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
*
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
Expand Down
4 changes: 0 additions & 4 deletions server/pom.xml
Expand Up @@ -65,10 +65,6 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-deployment-repository</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-embedded</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-platform-mbean</artifactId>
Expand Down

0 comments on commit 3f9cbf4

Please sign in to comment.