You have two possibilities
- Standard - use few test classes ran by Cucumber runners
- Write custom Cucumber jUnit runner (or take ready one) that supports multiple configurations.
In the first case, it will look like below. The disadvantage is that you have to define different reports for each runner and have almost identical Cucumber runners for each config.

Here's how classes can look like:
CucumberRunner1.java
@RunWith(Cucumber.class)
@CucumberOptions(glue = {"com.abc.def", "com.abc.common"},
features = {"classpath:com/abc/def/",
"classpath:com/abc/common.feature"},
format = {"json:target/cucumber/cucumber-report-1.json"},
tags = {"~@ignore"},
monochrome = true)
public class CucumberRunner1 {
}
StepAndConfig1.java
@ContextConfiguration(locations = {"classpath:/com/abc/def/configuration1.xml"})
public class StepsAndConfig1 {
@Then("^some useful step$")
public void someStep(){
int a = 0;
}
}
CucumberRunner2.java
@RunWith(Cucumber.class)
@CucumberOptions(glue = {"com.abc.ghi", "com.abc.common"},
features = {"classpath:com/abc/ghi/",
"classpath:com/abc/common.feature"},
format = {"json:target/cucumber/cucumber-report-2.json"},
tags = {"~@ignore"},
monochrome = true)
public class CucumberRunner2 {
}
OnlyConfig2.java
@ContextConfiguration(classes = JavaConfig2.class)
public class OnlyConfig2 {
@Before
public void justForCucumberToPickupThisClass(){}
}
The second approach is to use custom cucumber runner that supports multiple configurations. You can either write it by yourself or take ready one, for example, mine - CucumberJar.java and root of project cucumber-junit.
In this case Cucumber runner will looks like this:
CucumberJarRunner.java
@RunWith(CucumberJar.class)
@CucumberOptions(glue = {"com.abc.common"},
tags = {"~@ignore"},
plugin = {"json:target/cucumber/cucumber-report-common.json"})
@CucumberGroupsOptions({
@CucumberOptions(glue = {"com.abc.def"},
features = {"classpath:com/abc/def/",
"classpath:com/abc/common.feature"}
),
@CucumberOptions(glue = {"com.abc.ghi"},
features = {"classpath:com/abc/ghi/",
"classpath:com/abc/common.feature"}
)
})
public class CucumberJarRunner {
}