Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

package org.graalvm.buildtools.maven

import spock.lang.IgnoreIf
import spock.lang.Issue

class JavaApplicationWithTestsFunctionalTest extends AbstractGraalVMMavenFunctionalTest {
Expand Down Expand Up @@ -153,4 +154,32 @@ class JavaApplicationWithTestsFunctionalTest extends AbstractGraalVMMavenFunctio
outputContains "SurefirePlugin - Tests run: 8, Failures: 0, Errors: 0, Skipped: 0"
}

@IgnoreIf({ os.windows })
def "dependencies with scope provided are on classpath for test binary"() {
withSample("java-application-with-tests")

when:
mvn '-Pnative', '-DquickBuild', 'test'

def expectedOutput = ["local-repo", "org", "apache", "commons", "commons-lang3", "3.12.0", "commons-lang3-3.12.0.jar"].join(File.separator)

then:
buildSucceeded
outputContains expectedOutput
}

@IgnoreIf({ os.windows })
def "dependencies with scope provided are not on classpath for main binary"() {
withSample("java-application-with-tests")

when:
mvn '-Pnative', '-DquickBuild', '-DskipNativeTests', 'package'

def expectedOutput = ["local-repo", "org", "apache", "commons", "commons-lang3", "3.12.0", "commons-lang3-3.12.0.jar"].join(File.separator)

then:
buildSucceeded
outputDoesNotContain expectedOutput
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ protected List<String> getDependencyScopes() {
Artifact.SCOPE_COMPILE,
Artifact.SCOPE_RUNTIME,
Artifact.SCOPE_TEST,
Artifact.SCOPE_COMPILE_PLUS_RUNTIME
Artifact.SCOPE_COMPILE_PLUS_RUNTIME,
Artifact.SCOPE_PROVIDED
);
}

Expand Down
6 changes: 6 additions & 0 deletions samples/java-application-with-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
</properties>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Loading