-
Notifications
You must be signed in to change notification settings - Fork 4
Startup Java Project Configuration #3
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
Changes from 15 commits
f4a9810
235c777
a67dcf5
ab00b9c
b0d21d7
d86079e
0d4837a
7676add
c0d2766
c31c681
e109009
228d3dc
45c88d0
9162ffa
6d3a9f8
1e25bc5
8ca4248
b04f4be
9811c23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # IntelliJ | ||
| .idea/workspace.xml | ||
| .idea/libraries/ | ||
|
|
||
| # Maven | ||
| target/ | ||
| pom.xml.tag | ||
| pom.xml.releaseBackup | ||
| pom.xml.versionsBackup | ||
| pom.xml.next | ||
| release.properties | ||
| dependency-reduced-pom.xml | ||
| buildNumber.properties | ||
| .mvn/timing.properties | ||
|
|
||
| # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) | ||
| !/.mvn/wrapper/maven-wrapper.jar |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| sudo: required | ||
| language: java | ||
|
|
||
| services: | ||
| - docker | ||
|
|
||
| jdk: | ||
| - oraclejdk7 | ||
| - oraclejdk8 | ||
|
|
||
| env: | ||
| global: | ||
| - DOCKER_CFG=$HOME/.docker | ||
| - DOCKER_REPO="viniciusam/oracledb" | ||
| - MAVEN_HOME=/usr/local/maven | ||
| - UTPLSQL_VERSION="v3.0.0-beta" | ||
| - UTPLSQL_FILE="utPLSQLv3.0.0.562-beta" | ||
| matrix: | ||
| - ORACLE_VERSION="11g-xe-r2" CONNECTION_STR="127.0.0.1:1521/XE" DOCKER_OPTIONS="--shm-size=1g" | ||
|
|
||
| cache: | ||
| directories: | ||
| - $DOCKER_CFG | ||
| - $HOME/.m2 | ||
| - $MAVEN_HOME/lib/ext # Used to cache wagon-http lib. | ||
|
|
||
| install: | ||
| - bash .travis/maven_cfg.sh | ||
| - bash .travis/start_db.sh | ||
| - bash .travis/install_utplsql.sh | ||
|
|
||
| script: | ||
| - mvn test -B |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| set -ev | ||
|
|
||
| # Download the specified version of utPLSQL. | ||
| curl -L -O "https://github.com/utPLSQL/utPLSQL/releases/download/$UTPLSQL_VERSION/$UTPLSQL_FILE.tar.gz" | ||
|
|
||
| # Create a temporary install script. | ||
| cat > install.sh.tmp <<EOF | ||
| tar -xzf $UTPLSQL_FILE.tar.gz | ||
| rm $UTPLSQL_FILE.tar.gz | ||
| cd /$UTPLSQL_FILE/source | ||
| sqlplus -S -L sys/oracle@//$CONNECTION_STR AS SYSDBA @install_headless.sql | ||
| EOF | ||
|
|
||
| # Copy utPLSQL files to the container and install it. | ||
| docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz | ||
| docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh | ||
|
|
||
| # Remove temporary files. | ||
| rm $UTPLSQL_FILE.tar.gz | ||
| rm install.sh.tmp | ||
|
|
||
| # Execute the utPLSQL installation inside the container. | ||
| docker exec $ORACLE_VERSION bash install.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
| set -ev | ||
| cd $(dirname $(readlink -f $0)) | ||
|
|
||
| mavenSettings=$HOME/.m2/settings.xml | ||
| mavenCached=$HOME/.m2/.cached | ||
|
|
||
| if [ -f $mavenCached ]; then | ||
| echo "Using cached maven user config..." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "$ORACLE_OTN_USER" == "" ] || [ "$ORACLE_OTN_PASSWORD" == "" ]; then | ||
| echo "Oracle OTN username/password not specified." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Download wagon-http recommended by Oracle. | ||
| # On maven latest version this is not needed, but travis doesn't have it. | ||
| curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar" | ||
| sudo mv wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ | ||
|
|
||
| # Create the settings file with oracle server config. | ||
| cp settings.tmpl.xml $mavenSettings | ||
| sed -i -e "s|###USERNAME###|$ORACLE_OTN_USER|g" $mavenSettings | ||
| sed -i -e "s|###PASSWORD###|$ORACLE_OTN_PASSWORD|g" $mavenSettings | ||
|
|
||
| touch $mavenCached |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
|
|
||
| <servers> | ||
| <server> | ||
| <id>maven.oracle.com</id> | ||
| <username>###USERNAME###</username> | ||
| <password>###PASSWORD###</password> | ||
| <configuration> | ||
| <basicAuthScope> | ||
| <host>ANY</host> | ||
| <port>ANY</port> | ||
| <realm>OAM 11g</realm> | ||
| </basicAuthScope> | ||
| <httpConfiguration> | ||
| <all> | ||
| <params> | ||
| <property> | ||
| <name>http.protocol.allow-circular-redirects</name> | ||
| <value>%b,true</value> | ||
| </property> | ||
| </params> | ||
| </all> | ||
| </httpConfiguration> | ||
| </configuration> | ||
| </server> | ||
| </servers> | ||
|
|
||
| </settings> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
|
|
||
| <servers> | ||
| <server> | ||
| <id>maven.oracle.com</id> | ||
| <username>${env.ORACLE_OTN_USER}</username> | ||
| <password>${env.ORACLE_OTN_PASSWORD}</password> | ||
| <configuration> | ||
| <basicAuthScope> | ||
| <host>ANY</host> | ||
| <port>ANY</port> | ||
| <realm>OAM 11g</realm> | ||
| </basicAuthScope> | ||
| <httpConfiguration> | ||
| <all> | ||
| <params> | ||
| <property> | ||
| <name>http.protocol.allow-circular-redirects</name> | ||
| <value>%b,true</value> | ||
| </property> | ||
| </params> | ||
| </all> | ||
| </httpConfiguration> | ||
| </configuration> | ||
| </server> | ||
| </servers> | ||
|
|
||
| </settings> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/bash | ||
| set -ev | ||
|
|
||
| # If docker credentials are not cached, do the login. | ||
| if [ ! -f $DOCKER_CFG/config.json ]; then | ||
| docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" | ||
| else | ||
| echo "Using docker login from cache..." | ||
| fi | ||
|
|
||
| # Pull the specified db version from docker hub. | ||
| docker pull $DOCKER_REPO:$ORACLE_VERSION | ||
| docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 1521:1521 $DOCKER_REPO:$ORACLE_VERSION | ||
| docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| ##### Configuring the Oracle Maven Repository ##### | ||
| http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010 | ||
| https://blogs.oracle.com/dev2dev/entry/how_to_get_oracle_jdbc#pom | ||
|
|
||
| ##### IntelliJ IDEA Maven Module ##### | ||
| https://www.jetbrains.com/help/idea/2017.1/maven.html |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>io.github.utplsql</groupId> | ||
| <artifactId>java-api</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <name>utPLSQL-java-api</name> | ||
| <url>https://github.com/utPLSQL/utPLSQL-java-api</url> | ||
|
|
||
| <properties> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.oracle.jdbc</groupId> | ||
| <artifactId>ojdbc7</artifactId> | ||
| <version>12.1.0.2</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <repositories> | ||
| <repository> | ||
| <id>maven.oracle.com</id> | ||
| <releases> | ||
| <enabled>true</enabled> | ||
| </releases> | ||
| <snapshots> | ||
| <enabled>false</enabled> | ||
| </snapshots> | ||
| <url>https://maven.oracle.com</url> | ||
| <layout>default</layout> | ||
| </repository> | ||
| </repositories> | ||
|
|
||
| <pluginRepositories> | ||
| <pluginRepository> | ||
| <id>maven.oracle.com</id> | ||
| <url>https://maven.oracle.com</url> | ||
| </pluginRepository> | ||
| </pluginRepositories> | ||
|
|
||
| </project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package io.github.utplsql; | ||
|
|
||
| /** | ||
| * Hello world! | ||
| * | ||
| */ | ||
| public class App { | ||
|
|
||
| public static void main( String[] args ) { | ||
| System.out.println( "Hello World!" ); | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use java7 driver or go ahead with java8?
Maybe entire project should be build on java7?
Or do we want 2 separate builds with java7 and java8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use Java 8 because of lambda expressions and try with resources. But if we want to support both drivers, we can't use those new features anyways.
We could start with the Java 7 and add support to the newest later.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
Probably for Java8 we will need a separate branch/project then :(