diff --git a/.gitignore b/.gitignore index 789898d..441f065 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,10 @@ gradlew.bat /build/ +# Avoid ignoring lib jar files (.jar files are usually ignored) +!/libs/*.jar + + # Compiled source # ################### *.com @@ -49,6 +53,7 @@ gradlew.bat *.sql *.sqlite + # OS generated files # ###################### .DS_Store diff --git a/README b/README new file mode 100644 index 0000000..388a786 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ + +How to clone and build the project from the GitHub + +1. Create a folder we you want to handle the project and clone the +project from the GitHub by running +"git clone https://github.com/palych-piter/Excel2DB.git". +The Excel2Db subfolder should be created. + +2. Run the "gradlew shadowJar" gradle command. You should have the +Gradle pre-installed. + +3. All is set. The "build/libs/" subfolder should have the newest jar file +generated. By default the subfolder contains the property file pointing to +the Derby database as the testing implementation and test.xlsx +as the test Excel file. + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index bf9f05d..ced81c5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,11 @@ group 'excel2db' version '2.0' + apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' + buildscript { repositories { jcenter() @@ -13,6 +15,7 @@ buildscript { } } + sourceSets { main { java { @@ -67,6 +70,7 @@ dependencies { } + jar { manifest { @@ -94,6 +98,23 @@ jar { exclude '**/PopulateTablePostgresImplTest.class' } + //the copyFiles task executes right after the shadowJar and copy + //the property and test files into the build folder + task copyFiles { + doLast { + copy { + from 'src/main/resources/excel2db.properties' + into 'build/libs/' + } + copy { + from '/test.xlsx' + into 'build/libs/' + } + } + } + + shadowJar.finalizedBy(copyFiles) + } diff --git a/src/main/java/excel2db/service/impl/DBConnectionDerbyImpl.java b/src/main/java/excel2db/service/impl/DBConnectionDerbyImpl.java index 73a5240..9a5528b 100644 --- a/src/main/java/excel2db/service/impl/DBConnectionDerbyImpl.java +++ b/src/main/java/excel2db/service/impl/DBConnectionDerbyImpl.java @@ -31,6 +31,7 @@ public void establishDBConnection() { } catch (SQLException e) { logger.error("Derby Connection Failed! Check output console"); + } } } diff --git a/src/main/resources/excel2db.properties b/src/main/resources/excel2db.properties index b148553..f5515b8 100644 --- a/src/main/resources/excel2db.properties +++ b/src/main/resources/excel2db.properties @@ -5,7 +5,7 @@ db.implementation=Derby # names of input tables -input.files=test.xlsx,test1.xlsx +input.files=test.xlsx # postgres connection parameters db.server=localhost