例
sqlplus hoge@pdb1/hoge@orcl
sqlplus hoge@pdb1/hoge@orcl
compile 'org.thymeleaf.extras:thymeleaf-extras-java8time:2.1.0.RELEASE'
<span th:text="${#temporals.format(nowDateTime, 'yyyy/MM/dd HH:mm:ss')}"></span><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
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.3</version>
</dependency>
</dependencies>
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/test_db</url>
<username>test</username>
<password>test</password>
<srcFiles>
<srcFile>src/test/resources/test.sql</srcFile>
</srcFiles>
</configuration>
</plugin>
</plugins>
</build>
$ mvn sql:execute
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sql-maven-plugin 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sql-maven-plugin:1.5:execute (default-cli) @ sql-maven-plugin ---
[INFO] Executing file: /tmp/test.838893334sql
[INFO] 1 of 1 SQL statements executed successfully
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.428 s
[INFO] Finished at: 2017-07-29T06:59:17+09:00
[INFO] Final Memory: 9M/238M
[INFO] ------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="access" suffix=".log" pattern="%h %l %u %t "%r" %s %b" />
</Context>
final Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
final String docBase = new File("src/main/webapp").getAbsolutePath();
final StandardContext context = (StandardContext) tomcat.addWebapp("/", docBase);
final File additionWebInfClasses = new File("build/classes/main");
final StandardRoot resources = new StandardRoot(context);
resources.addPreResources(
new DirResourceSet(resources, "/WEB-INF/classes",
additionWebInfClasses.getAbsolutePath(), "/"));
context.setResources(resources);
tomcat.start();
tomcat.getServer().await();
➜ tomcat-embedded-example cat tomcat.8080/logs/access.2017-07-15.log
127.0.0.1 - - [15/Jul/2017:15:36:39 +0900] "GET / HTTP/1.1" 200 89
127.0.0.1 - - [15/Jul/2017:15:36:43 +0900] "GET /hoge HTTP/1.1" 404 1002