Does Gemnasium support maven multi-modules projects?

Gemnasium currently doesn't provide out-of-the box support for such projects. 

Until we bring such support, there is a workaround which requires some more manual steps to configure each module as an independent Gemnasium project. 

Here is how to proceed:

1) Add the plugin configuration in the parent pom.xml (you may check the plugin version for latest update):
<plugin>
  <groupId>com.gemnasium</groupId>
  <artifactId>gemnasium-maven-plugin</artifactId>
  <version>0.3.0</version>
  <configuration>
    <apiKey>YOUR_API_KEY</apiKey>
  </configuration>
  <executions>
    <execution>
      <phase>verify</phase>
      <goals>
        <goal>send-dependencies</goal>
      </goals>
    </execution>
  </executions>
</plugin>
2) create a Gemnasium project for the Maven parent project (myProject-parent)

3) create a Gemnasium project for the each modules (myProject-Module-1, myProject-Module-2, myProject-Module-3, etc.)

Now your CI should automatically execute the Gemnasium maven plugin for each module, updating them all at once during your build.

NB:  It may be a good idea to have a common prefix for all the Gemnasium projects as it will make it easier to have a grouped view of all submodule in the UI.

Here is a small script to automate projects creation (you need to adapt it to your own multi-module projects first):
#!/bin/bash
set -e

# 1-Configure
teamSlug="my-team"
projectPrefix="myProject-"
modules="module-1 module-2 module-3"

# 2-Create gemnasium project for parent
# ensure gemnasium.properties destination dir exists
mkdir -p ./src/main/resources
# run create-project command for parent only (--non-recursive option)
mvn gemnasium:create-project -DteamSlug=$teamSlug -DprojectName="${projectPrefix}parent" --non-recursive


# 3-Create gemnasium project for each module
for module in $modules ; do
  pushd . > /dev/null
  cd ./$module
  mvn gemnasium:create-project -DteamSlug=$teamSlug -DprojectName="${projectPrefix}${module}"
  popd > /dev/null
done

NB: This setup leverages the gemnasium.properties files and only requires you to put the plugin configuration in the parent pom.xml.
This also means that you can't configure the projectSlug in the parent pom.xml file because it will take precedence over the gemnasium.properties of each module. 

If you prefer to go with pom.xml only configuration, then you'll need to override the plugin config in each module's pom.xml to set the correct projectSlug.

Feedback and Knowledge Base