Skip to content

Commit

Permalink
fix: Optional maven dependencies should not be passed to SpoonMavenLa…
Browse files Browse the repository at this point in the history
…uncher (#1619)
  • Loading branch information
surli authored and monperrus committed Oct 21, 2017
1 parent f2736b7 commit 8084760
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/spoon/MavenLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ private String extractVariable(String value) {

/**
* Get the list of dependencies available in the local maven repository
*
* @param isLib: If false take dependency of the main project; if true, take dependencies of a library of the project
* @return the list of dependencies
*/
public List<File> getDependencies(boolean isLib) {
Expand Down Expand Up @@ -268,9 +270,11 @@ public List<File> getDependencies(boolean isLib) {
if (version.startsWith("[")) {
version = version.substring(1, version.indexOf(','));
}
if (dependency.isOptional()) {
// pass only the optional dependency if it's in a library dependency
if (isLib && dependency.isOptional()) {
continue;
}

// ignore test dependencies for app source code
if ("test".equals(dependency.getScope()) && SOURCE_TYPE.APP_SOURCE == sourceType) {
continue;
Expand Down

0 comments on commit 8084760

Please sign in to comment.