I created a similar model that you can study.
Using Maven, he will be an IDE agnostic as soon as possible. You will not need to store any specific IDE settings in your VCS, only the source code and pom files. Each developer will launch his IDE and point to the top-pom and the project should load. Local settings will be created, but should be ignored when transferring to VCS.
First of all, a Maven project with several modules will definitely have a very similar layout, like a C # solution with its projects. The top folder with the parent pom will look like a solution with general configurations and build order, etc. Subfolders with sub-pumps will then correspond to the project definitions with dependencies between other projects.
directory layout
+- pom.xml +- scala | +- pom.xml | +- src | +- main | +- scala +- console | +- pom.xml | +- src | +- main | +- java +- web +- pom.xml +- src +- main +- java +- resources +- webapp +- WEB-INF -- web.xml
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>${project.artifactId}-${project.version}</name> <properties> <scala.version>2.9.2</scala.version> </properties> <modules> <module>scala</module> <module>web</module> <module>console</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363-scala</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> </dependencies> </dependencyManagement> <repositories> <repository> <id>scala-tools.org</id> <name>Scala Tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>scala-tools.org</id> <name>Scala Tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </pluginRepository> </pluginRepositories> </project>
scala/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>Q11226363-scala</artifactId> <name>${project.artifactId}-${project.version}</name> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> </dependency> </dependencies> <build> <sourceDirectory>src/main/scala</sourceDirectory> <plugins> <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <executions> <execution> <id>compile</id> <goals> <goal>compile</goal> </goals> <phase>compile</phase> </execution> <execution> <id>test-compile</id> <goals> <goal>testCompile</goal> </goals> <phase>test-compile</phase> </execution> </executions> </plugin> </plugins> </build> </project>
console/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>Q11226363-console</artifactId> <name>${project.artifactId}-${project.version}</name> <dependencies> <dependency> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363-scala</artifactId> </dependency> </dependencies> </project>
web/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>Q11226363-web</artifactId> <packaging>war</packaging> <name>${project.artifactId}-${project.version}</name> <dependencies> <dependency> <groupId>com.stackoverflow</groupId> <artifactId>Q11226363-scala</artifactId> </dependency> </dependencies> <build> <finalName>webapp</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> </plugin> </plugins> </build> </project>
scala/src/main/scala/com/stackoverflow/Q11226363/ScalaApp.scala
package com.stackoverflow.Q11226363 class ScalaApp { def helloScala():String = "Hello from Scala!" }
console/src/main/java/com/stackoverflow/Q11226363/JavaApp.java
package com.stackoverflow.Q11226363; public class JavaApp { public static void main(String[] args) { ScalaApp scalaApp = new ScalaApp(); System.out.println("Scala says: " + scalaApp.helloScala()); } }
This has been verified by me. Of course, there may be some improvements in pom files and dependencies, but this is a good start.
If you look in web/target , you will find your webapp.war , which will include the necessary dependencies.
Of course, you can break down all these modules and build them separately and still have dependencies between them, but, as I said, this is a good starting point.