making jar with conf files
hello i have one java maven proyecto. into this proyect i have one dir myconf with the conf files whe i make the jar install (mvn clean install) it creates the jar files with the code but no the con files. the structure is: myproyecto |-src/java/main/. |-myconf |-miconf.properties |-myconf.xml into my jar only appears the META-INF dir and the code but not the myconf directory and the conf files. the pom.xml file is: 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; modelVersion4.0.0/modelVersion groupIdmygroup/groupId artifactIdmyid/artifactId namemyid/name packagingjar/packaging version0.0.1-SNAPSHOT/version descriptionmyid/description build sourceDirectory${basedir}/src/java/main/sourceDirectory filters /filters resources resource directoryc:\config/directory filteringtrue/filtering includes includemyconf/**/*.*/include /includes /resource /resources plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.6/source target1.6/target encodingCp1252/encoding /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-dependency-plugin/artifactId executions execution idcopy-dependencies/id phasepackage/phase goals goalcopy-dependencies/goal /goals configuration outputDirectory target/lib /outputDirectory overWriteReleasestrue/overWriteReleases overWriteSnapshots true /overWriteSnapshots overWriteIfNewertrue/overWriteIfNewer /configuration /execution /executions /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jar-plugin/artifactId version2.5/version configuration archive manifest mainClass com.myo.myclass /mainClass addClasspathtrue/addClasspath classpathPrefixlib/classpathPrefix /manifest manifestEntries Autoryo/Autor Empresaanonimo/Empresa Built-Bymio/Built-By /manifestEntries /archive /configuration /plugin /plugins /build dependencies dependency groupIdorg.apache.poi/groupId artifactIdpoi/artifactId version3.6/version /dependency dependency groupIdorg.apache.poi/groupId artifactIdpoi-ooxml/artifactId version3.6/version /dependency dependency groupIdlog4j/groupId artifactIdlog4j/artifactId version1.2.15/version /dependency /dependencies /project
Re: making jar with conf files
You shouldn't really configure a new resources folder (with an hard-coded path) for this. Just use the standard src/main/resources and put your config folder there with it's files. If you want filtering you need to configure that though, but start without that and make sure you get what you want included in the jar first. Then you can start adding the filtering option. /Anders On Mon, Sep 15, 2014 at 5:59 PM, Aitor Iturriondobeitia laudio.i...@gmail.com wrote: hello i have one java maven proyecto. into this proyect i have one dir myconf with the conf files whe i make the jar install (mvn clean install) it creates the jar files with the code but no the con files. the structure is: myproyecto |-src/java/main/. |-myconf |-miconf.properties |-myconf.xml into my jar only appears the META-INF dir and the code but not the myconf directory and the conf files. the pom.xml file is: 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; modelVersion4.0.0/modelVersion groupIdmygroup/groupId artifactIdmyid/artifactId namemyid/name packagingjar/packaging version0.0.1-SNAPSHOT/version descriptionmyid/description build sourceDirectory${basedir}/src/java/main/sourceDirectory filters /filters resources resource directoryc:\config/directory filteringtrue/filtering includes includemyconf/**/*.*/include /includes /resource /resources plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.6/source target1.6/target encodingCp1252/encoding /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-dependency-plugin/artifactId executions execution idcopy-dependencies/id phasepackage/phase goals goalcopy-dependencies/goal /goals configuration outputDirectory target/lib /outputDirectory overWriteReleasestrue/overWriteReleases overWriteSnapshots true /overWriteSnapshots overWriteIfNewertrue/overWriteIfNewer /configuration /execution /executions /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jar-plugin/artifactId version2.5/version configuration archive manifest mainClass com.myo.myclass /mainClass addClasspathtrue/addClasspath classpathPrefixlib/classpathPrefix /manifest manifestEntries Autoryo/Autor Empresaanonimo/Empresa Built-Bymio/Built-By /manifestEntries /archive /configuration /plugin /plugins /build dependencies dependency groupIdorg.apache.poi/groupId artifactIdpoi/artifactId version3.6/version /dependency dependency groupIdorg.apache.poi/groupId artifactIdpoi-ooxml/artifactId version3.6/version /dependency dependency groupIdlog4j/groupId artifactIdlog4j/artifactId version1.2.15/version /dependency /dependencies /project
Re: making jar with conf files
Hi Aitor, You should place all your configuration files under src/main/resources. For example: src/main/resources/myconf/myconf.properties. All files under src/main/resources will get packaged into your artifact's jar file. Furthermore, all your test resources should be placed (likewise) under src/test/resources. The resources under there won't be packaged under your final artifact and will only be used for the purpose of your tests. Kind regards, Martin On Mon, Sep 15, 2014 at 4:59 PM, Aitor Iturriondobeitia laudio.i...@gmail.com wrote: hello i have one java maven proyecto. into this proyect i have one dir myconf with the conf files whe i make the jar install (mvn clean install) it creates the jar files with the code but no the con files. the structure is: myproyecto |-src/java/main/. |-myconf |-miconf.properties |-myconf.xml into my jar only appears the META-INF dir and the code but not the myconf directory and the conf files. the pom.xml file is: 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; modelVersion4.0.0/modelVersion groupIdmygroup/groupId artifactIdmyid/artifactId namemyid/name packagingjar/packaging version0.0.1-SNAPSHOT/version descriptionmyid/description build sourceDirectory${basedir}/src/java/main/sourceDirectory filters /filters resources resource directoryc:\config/directory filteringtrue/filtering includes includemyconf/**/*.*/include /includes /resource /resources plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.6/source target1.6/target encodingCp1252/encoding /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-dependency-plugin/artifactId executions execution idcopy-dependencies/id phasepackage/phase goals goalcopy-dependencies/goal /goals configuration outputDirectory target/lib /outputDirectory overWriteReleasestrue/overWriteReleases overWriteSnapshots true /overWriteSnapshots overWriteIfNewertrue/overWriteIfNewer /configuration /execution /executions /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jar-plugin/artifactId version2.5/version configuration archive manifest mainClass com.myo.myclass /mainClass addClasspathtrue/addClasspath classpathPrefixlib/classpathPrefix /manifest manifestEntries Autoryo/Autor Empresaanonimo/Empresa Built-Bymio/Built-By /manifestEntries /archive /configuration /plugin /plugins /build dependencies dependency groupIdorg.apache.poi/groupId artifactIdpoi/artifactId version3.6/version /dependency dependency groupIdorg.apache.poi/groupId artifactIdpoi-ooxml/artifactId version3.6/version /dependency dependency groupIdlog4j/groupId artifactIdlog4j/artifactId version1.2.15/version /dependency /dependencies /project