4. Aplicación Java (II): Parámeros básicos, build.gradle ..

 1. Fichero src/main/resources/app.properties

Como se pueden sacar los CSVs desde distintas aplicaciones (Gexflow, Ayots, GTT, Sedipualba),  se pueden configurar para cada una de ellas. Si no se utilizan,  solamente hay que hacer caso hasta el punto 4 inclusive (Alfresco)

#1. Logging for those who have accessed to get CSVs
log.file=/home/informatica/csv.log

#2. Carpeta on guardar els recusos
resources.folder=/home/informatica/MyResources

#3. SEDE VALIDACIO CSV
gexflow.csv.url      =https://csv.miayuntamiento.es:19443/CSV

#4. ALFRESCO
alfresco.URL= http://192.168.XX.XX:8080/alfresco/cmisatom
alfresco.user=user-alfresco
alfresco.password=pwd-alfresco

#5. FIRMADOC
smb.domain=MI_AYUNTAMIENTO
smb.user=user-samba
smb.pwd=pwd-samba
smb.server=192.168.XX.XX
smb.shared.firmadoc.dir=FIRMADOC

#6.GTT
driver.path=/home/informatica/MyPrograms/Selenium/chromedriver
gtt.csv.url= https://miayuntamiento.tributoslocales.es/46XXXX/MI-PUEBLO/csv
gtt.download.folder=/home/informatica/MyResources

2. Estructura de la aplicación

En esta imagen se ve la estructura del proyecto

3. build.gradle


Este proyecto es un subproyecto de otro mayor, para poder reutiizar el código de otros proyectos.
Hay que tener en cuenta que Eclipse no está bien integrado con Gradle, pues la parte de generación de ficheros "war" suele fallar y pierde algunas de las referencias de los proyectos hermanos.

Para capear el temporal, se hacen 2 versiones del build.gradle, una para Eclipse y otra para Gradle. 

En el fichero se comenta como se hace
plugins {
    // Apply the java-library plugin for API and implementation separation.
    id 'java-library'
    id 'war'
    //id 'java'
    //id 'application'
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" } //@see: https://stackoverflow.com/questions/38905939/how-to-import-library-from-jitpack-io-using-gradle
    jcenter()
}


//Configuration
project.war.destinationDirectory = file("$rootDir/../mynewtargets2")  
//project.jar.destinationDirectory = file("$rootDir/../mynewtargets2")
project.archivesBaseName = 'W01-CSV' 
project.version = '4.0'


dependencies {
    // Use JUnit test framework.
    testImplementation libs.junit.jupiter
    testImplementation libs.junit //Sembla que la demana
        
    //=============LOMBOK BEGIN ============================
    // Not generated by the Vaadin starting-project
    compileOnly             libs.lombok // use version catalog in the file "settings.gradle"
    annotationProcessor     libs.lombok // use version catalog in the file "settings.gradle"
    testCompileOnly         libs.lombok // use version catalog in the file "settings.gradle"
    testAnnotationProcessor libs.lombok // use version catalog in the file "settings.gradle"
    //=============LOMBOK END ==============================
    // JSP & SERVLETS
    //compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0'
    
   
    compileOnly    libs.jakarta.servlet.api
    
    compileOnly    libs.jakarta.servlet.jsp.jstl.api
    //implementation libs.glassfish.servlet.jsp.jstl
    
    compileOnly    libs.jakarta.jakartaee.api
    compileOnly    libs.jakarta.el.api
    //compileOnly    libs.jakarta.jakartaee.web.api //Multipart
    //implementation libs.jakarta.activation.api
    compileOnly    libs.jakarta.activation.api
    
    //implementation 'org.apache.tomcat:tomcat-dbcp:10.0.23'
    compileOnly    'org.apache.tomcat:tomcat-dbcp:10.0.23'
    
    
    
      // Jackson //
    api libs.jackson.databind  
    api libs.jackson.datatype.jsr310
    
    // PDF BOX //
    api libs.pdfbox
    
    //Log4j//
    //api libs.log4j.api
    //api libs.log4j.core
    
    
	
    
    
    
    /***************************************************************************************
    * WEB PROJECTS:
    * a) If running in eclipse the web projects:
    *       DO NOT USE api (poject(":MyProject"))  (DON'T USE GRADLE MULTIPROJECT)
    *       USE implementation files("$rootDir/../mynewtargets2/a00-basic-4.0.jar", ...) instead
    *
    * b) If generating "war" in Gradle for web projects:
    *       USE api (poject(":MyProject"))  (DON'T USE GRADLE MULTIPROJECT)
    *       DO NOT USE implementation files("$rootDir/../mynewtargets2/a00-basic-4.0.jar", ...) 
    *
    *****************************************************************************************/ 
    
    //b) ONLY GRADLE   ***********************************************
    api (project(":A00-Basic")) 
    api (project(":C02-Model-Control")) 
    
    // END ONLY GRADLE ***********************************************
    
    
    //a) ONLY ECLIPSE RUNNING AND DEBUGGING  *************************
    
    api files(
    	"$rootDir/../mynewtargets2/a00-basic-4.0.jar",
    	"$rootDir/../mynewtargets2/b00-model-dao-4.0.jar",
    	"$rootDir/../mynewtargets2/c02-model-control-4.0.jar",
    )
    
    // END ONLY ECLIPSE RUNNING AND DEBUGGING ************************
}    

jar {   
    from sourceSets.main.allSource  //Include java sources
}


4. settings.gradle


Este fichero es el de la configuración del proyecto padre, se definen los proyectos hijos y la referencia a las librería utilizadas 

rootProject.name = 'Ajuntament'

include(
  'A00-Basic',          'A02-Jackson', 
  'B00-Model-DAO',      'B01-Gson' ,
  'C02-Model-Control',  'C03-Model-Aytos',    'C04-Model-Castilla',   'C05-Model-CSV', 
  'C06-Model-ORVE',     'C07-Model-Gexflow',  'C08-Model-Cementeri',  'C09-Model-ENI',
  'G01-WS',
  'W00-REST',           'W01-CSV',
  'X04-IF08'      
)


dependencyResolutionManagement {
    versionCatalogs {
        libs {
            //library('commons-lang3', 'org.apache.commons', 'commons-lang3').version {
            //    strictly '[3.8, 4.0['
            //    prefer '3.9'
            //}
            
            
            library('junit-jupiter',                 'org.junit.jupiter:junit-jupiter:5.9.0')     //5.7.2
            library('junit',                         'junit:junit:4.13.2')     
            
            
            library('lombok',                        'org.projectlombok:lombok:1.18.24')      //1.18.20
                        
            
            library('commons-beanutils',             'commons-beanutils:commons-beanutils:1.9.4')
            library('commons-io',                    'commons-io:commons-io:2.11.0')
            library('commons-lang3',                 'org.apache.commons:commons-lang3:3.12.0')
            library('commons-codec',                 'commons-codec:commons-codec:1.15')
            
            library('poi',                           'org.apache.poi:poi:5.2.2')
            library('poi-ooxml',                     'org.apache.poi:poi-ooxml:5.2.2')
            library('poi-scratchpad',                'org.apache.poi:poi-scratchpad:5.2.2')

            library('pdfbox',                        'org.apache.pdfbox:pdfbox:2.0.26') //2.0.24
            
            library('chemistry-opencmis-client-impl','org.apache.chemistry.opencmis:chemistry-opencmis-client-impl:1.1.0')
            
            library('commons-vfs2',                  'org.apache.commons:commons-vfs2:2.9.0')
            library('commons-exec',                  'org.apache.commons:commons-exec:1.3')
            library('commons-compress',              'org.apache.commons:commons-compress:1.21')
            
            
            library('jsch',                          'com.jcraft:jsch:0.1.55')
            
            library('juniversalchardet',             'com.googlecode.juniversalchardet:juniversalchardet:1.0.3')
            
            
            
            library('jackson.core',                  'com.fasterxml.jackson.core:jackson-core:2.13.4')        //2.13.3
            library('jackson.core.annotations',      'com.fasterxml.jackson.core:jackson-annotations:2.13.4') //2.13.3
            library('jackson.databind',              'com.fasterxml.jackson.core:jackson-databind:2.13.4')    //2.13.3
            library('jackson.dataformat-yaml',       'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4') //2.13.3
            library('jackson-dataformat-xml',        'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.4')  //2.13.3
            library('jackson-module-jakarta-xmlbind-annotations',      
                                                     'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.13.4') //2.13.3
            library('jackson-datatype-jdk8',         'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4')     //2.13.3
            library('jackson-datatype-jsr310',       'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4')   //2.13.3
            library('jackson-datatype-jsr353',       'com.fasterxml.jackson.datatype:jackson-datatype-jsr353:2.13.4')   //2.13.3
            library('jackson-datatype-json-org',     'com.fasterxml.jackson.datatype:jackson-datatype-json-org:2.13.4') //2.13.3
            
            
            //library('jackson-jaxrs-base',            'com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.13.3')
            //library('jackson-jaxb-annotations' ,     'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.13.3')
            //library('jackson-json-provider'    ,     'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.13.3')
              
            library('jodconverter-core',             'org.jodconverter:jodconverter-core:4.4.2')
            library('jodconverter-local',            'org.jodconverter:jodconverter-local:4.4.2')
            
            library('smbj',                          'com.hierynomus:smbj:0.11.5') //0.11.3
            
            
            library('barbecue',                      'net.sourceforge.barbecue:barbecue:1.5-beta1')
            library('barcode4j',                     'net.sf.barcode4j:barcode4j:2.1')
            library('zxing-core',                    'com.google.zxing:core:3.5.0')  //3.4.1
            library('zxing-javase',                  'com.google.zxing:javase:3.5.0') //3.4.1
            //library('qrgen-core',                    'com.github.kenglxn.qrgen:core:v2.2.0')
            
            
            library('selenium-server',               'org.seleniumhq.selenium:selenium-server:3.141.59')
            library('selenium-java',                 'org.seleniumhq.selenium:selenium-java:4.5.2')          //4.4.0  4.1.2
            library('selenium-firefox-driver',       'org.seleniumhq.selenium:selenium-firefox-driver:4.5.2')//4.4.0  4.1.2
            library('selenium-chrome-driver',        'org.seleniumhq.selenium:selenium-chrome-driver:4.5.2') //4.4.0  4.1.2
            
            library('ph-commons',                    'com.helger.commons:ph-commons:10.2.0') //10.1.6
            
            
            library('hibernate-core-jakarta',        'org.hibernate:hibernate-core-jakarta:5.6.11.Final')   //5.6.9.Final
            library('hibernate-envers-jakarta',      'org.hibernate:hibernate-envers-jakarta:5.6.1.Final') //5.6.9.Final
            library('hibernate-validator',           'org.hibernate:hibernate-validator:7.0.5.Final')      //7.0.4.Final
            
            library('h2',                            'com.h2database:h2:2.1.214') //1.4.200
            library('postgresql',                    'org.postgresql:postgresql:42.5.0') //42.2.20
            library('jtds',                          'net.sourceforge.jtds:jtds:1.3.1')
            
            
            
            library('jakarta.servlet-api',           'jakarta.servlet:jakarta.servlet-api:6.0.0') //5.0.0  
            library('jakarta.servlet.jsp-api',       'jakarta.servlet.jsp:jakarta.servlet.jsp-api:3.1.0') //Nou
            library('glassfish.servlet.jsp',         'org.glassfish.web:jakarta.servlet.jsp:3.0.0') //Nou
            library('jakarta.servlet.jsp.jstl-api',  'jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0') //Nou
            library('glassfish.servlet.jsp.jstl',    'org.glassfish.web:jakarta.servlet.jsp.jstl:2.0.0') //2.0.0 3.00 demana la api-RC i no la troba
            library('jakarta.jakartaee-api',         'jakarta.platform:jakarta.jakartaee-api:9.1.0')
            library('jakarta.el.api',                'jakarta.el:jakarta.el-api:5.0.1') //4.0.0
            library('glassfish.el',                  'org.glassfish:jakarta.el:4.0.2') //Nou
            library('jakarta.jakartaee-web-api',     'jakarta.platform:jakarta.jakartaee-api:9.1.0')
            library('jakarta.activation-api',        'jakarta.activation:jakarta.activation-api:2.1.0')
            library('jakarta.xml.ws-api',            'jakarta.xml.ws:jakarta.xml.ws-api:4.0.0')
            
            
            library('javax.xml.ws-api',              'javax.xml.ws:jaxws-api:2.3.1')
            library('javax.xml.bind.jaxb-api',       'javax.xml.bind:jaxb-api:2.4.0-b180830.0359')
            library('javax.xml.bind.imp',            'org.glassfish:javax.xml.bind:10.0-b28')
            
            
            library('woodstox-core',                 'com.fasterxml.woodstox:woodstox-core:6.3.1') //6.2.8
            
            library('cxf-core',                      'org.apache.cxf:cxf-core:3.5.3')
            library('cxf-rt-features-logging',       'org.apache.cxf:cxf-rt-features-logging:3.5.3')
            library('cxf-rt-ws-security',            'org.apache.cxf:cxf-rt-ws-security:3.5.3')
            library('cxf-rt-frontend-jaxws',         'org.apache.cxf:cxf-rt-frontend-jaxws:3.5.3')
            library('cxf-rt-transports-http',        'org.apache.cxf:cxf-rt-transports-http:3.5.3')
            
            library('wss4j-ws-security-dom',         'org.apache.wss4j:wss4j-ws-security-dom:2.4.1') //2.4.0
            library('wss4j',                         'org.apache.wss4j:wss4j:2.4.1') //2.4.0
            
            library('jaxws-ri',                      'com.sun.xml.ws:jaxws-ri:2.3.5') //4.0.0 NO VA ELS WS NO TROBA java.xml.bind.annotation does not exists??
            library('jaxws-rt',                      'com.sun.xml.ws:jaxws-rt:2.3.5') //4.0.0 NO VA??
            
            
            
            library('jaxb-runtime3',                 'org.glassfish.jaxb:jaxb-runtime:4.0.0') //3.0.3
            
            library('itext7-core',                   'com.itextpdf:itext7-core:7.2.3')  //7.2.1
            library('itext2',                        'com.lowagie:itext:2.1.7') // IText VELL pero el vol jasper reports ????????? 
           
            
            library('jasperreports',                 'net.sf.jasperreports:jasperreports:6.20.2') //6.17.0
            
           
            
            library('zip4j',                         'net.lingala.zip4j:zip4j:2.11.1')  //2.9.1
            
            library('simple-java-mail',              'org.simplejavamail:simple-java-mail:7.5.0') //7.1.1
            
            library('sikulix',                       'com.sikulix:sikulixapi:2.0.5')
            
            library('guava-jre',                     'com.google.guava:guava:31.1-jre')
            
            
            //library('resteasy-jaxrs',                'org.jboss.resteasy:resteasy-jaxrs:3.15.3.Final')
            //library('resteasy-servlet',              'org.jboss.resteasy:resteasy-servlet-initializer:6.1.0.Final')
            //library('resteasy-jackson2',             'org.jboss.resteasy:resteasy-jackson2-provider:6.1.0.Final')
            //library('resteasy-client',               'org.jboss.resteasy:resteasy-client:6.1.0.Final')
            //library('resteasy-cdi',                  'org.jboss.resteasy:resteasy-cdi:6.1.0.Final')
             
            library('weld',                          'org.jboss.weld.servlet:weld-servlet-shaded:5.0.1.Final')
            
            library('gson',                          'com.google.code.gson:gson:2.9.1')
            
        }
    }
}




Comentarios

Entradas populares de este blog

1. Instalación del servidor Tomcat y VSFTP , certificados y librerias

3. Aplicación Java (I): Consulta de documentos y firmas de Gexflow a la BD. Arreglar el documento