<div th:attr="data-sample=${sample.name}"></div>
複数ある場合はカンマで区切って列挙する。
<div th:attr="data-sample=${sample.name},data-sample2=${sample.name2}"></div>
<div th:attr="data-sample=${sample.name}"></div>
<div th:attr="data-sample=${sample.name},data-sample2=${sample.name2}"></div>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<jvm>/opt/java/jdk1.6.0_45/bin/java</jvm>
</configuration>
</plugin>
public class HogeTest {
@Test
public void name() throws Exception {
System.out.println("System.getProperty(\"java.version\") = " + System.getProperty("java.version"));
}
}
$ export JAVA_HOME=/opt/java/jdk1.8.0_141
$ mvn test
********** 省略 **********
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running HogeTest
System.getProperty("java.version") = 1.6.0_45
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.955 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
dependencies {
testCompile 'org.jmockit:jmockit:1.33'
testCompile 'junit:junit:4.12'
}
Caused by: java.lang.IllegalStateException: Running on JDK 9 requires
-javaagent:/jmockit-1.n.jar or -Djdk.attach.allowAttachSelf
test {
jvmArgs "-Djdk.attach.allowAttachSelf"
}
➜ java9 ./gradlew clean test
BUILD SUCCESSFUL in 2s
3 actionable tasks: 3 executed
➜ java9 ./gradlew clean test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release