maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eyal edri <eyal.e...@gmail.com>
Subject Re: best practice to include resources in the jar file and unpack them on target server
Date Thu, 21 Jan 2010 10:54:14 GMT
I'm actually very familiar with maven, and i read both "better builds with
maven" and "the definite guide".

i wasn't aware that the jar auto packs the resources files as well.
i removed the section of the jar plugin below, and i still see the files
included:

$ jar tf /usr/lib/ctch/java/IncreasePriority/IncreasePriority.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/company/
com/company/url/
com/company/url/unknowns/
com/company/url/unknowns/IncreasePriority.class
increase-priority.properties
increase-priority.cron
META-INF/maven/
META-INF/maven/com.company.url.unknowns/
META-INF/maven/com.company.url.unknowns/IncreasePriority/
META-INF/maven/com.company.url.unknowns/IncreasePriority/pom.xml
META-INF/maven/com.company.url.unknowns/IncreasePriority/pom.properties


so to my original question, how to i copy the files from the jar after i
install it on the target server?

On Thu, Jan 21, 2010 at 12:32 PM, Martin Höller <martin@xss.co.at> wrote:

> Hi!
>
> Am Donnerstag, 21. Januar 2010 10:25:20 schrieb eyal edri:
> > i'v included resource files inside the jar file using the include tag:
> >
> > <profile>
> >       <id>devel</id>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <groupId>org.apache.maven.plugins</groupId>
> >             <artifactId>maven-jar-plugin</artifactId>
> >             <configuration>
> >               <classesDirectory>src/main/resources</classesDirectory>
> >               <includes>
> >                 <include>**/*</include>
> >               </includes>
> >             </configuration>
> >           </plugin>
> >         </plugins>
> >       </build>
> >     </profile>
>
> What you are doing here is telling the maven-jar-plugin, that classes are
> found in src/main/resources, which is nonsense!
>
> What you should do, is put your resources in src/main/resources and they
> should end up in target/classes and the produced JAR automatically when
> running mvn package or the like.
>
> It seems you are not familiar with maven and I strongly recommend reading a
> maven book, like sonatype's Maven: The Definitve Guide", which is available
> online [0] for free.
>
> hth,
> - martin
>
> [0] http://www.sonatype.com/book/
>



-- 
Eyal Edri

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message