Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Optional maven dependencies should not be pass in SpoonMavenLauncher #1619

Merged
merged 2 commits into from
Oct 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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