Re: best practice to include resources in the jar file and unpack them on target server

2010-01-21 Thread Martin Höller
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
   iddevel/id
   build
 plugins
   plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-jar-plugin/artifactId
 configuration
   classesDirectorysrc/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/


signature.asc
Description: This is a digitally signed message part.


Re: best practice to include resources in the jar file and unpack them on target server

2010-01-21 Thread eyal edri
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 mar...@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
iddevel/id
build
  plugins
plugin
  groupIdorg.apache.maven.plugins/groupId
  artifactIdmaven-jar-plugin/artifactId
  configuration
classesDirectorysrc/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


Re: best practice to include resources in the jar file and unpack them on target server

2010-01-21 Thread Martin Höller
Am Donnerstag, 21. Januar 2010 11:54:14 schrieb eyal edri:
 so to my original question, how to i copy the files from the jar after i
 install it on the target server?

Extract the resource files from the JAR-File using 'jar' or 'zip' utilities, 
and copy them to the location where you want them to be.

This is not related to maven any more. There was actually a thread about 
something similar two days ago... and while searching for it, I found that 
you were the original poster. The last mail from Thod Tiessen [0] in this 
thread hits the nail on the head, IMHO.

hth,
- martin

[0] 
http://old.nabble.com/install-maven-project-from-repository-to-local-fs-to27209691.html#a27227458


signature.asc
Description: This is a digitally signed message part.


Re: best practice to include resources in the jar file and unpack them on target server

2010-01-21 Thread eyal edri
I don't agree with the conception that uber (or fat) jar is the way to go.
IMO, you loose all the advantages maven dependency supplies if you do so (as
i mentioned, you need to install all your application in case you change one
line of code in one of your infrastructure jars..)

i know maven isn't supposed to be used for deployment, but with a little
open mind and flexibility, it can be done.

On Thu, Jan 21, 2010 at 1:46 PM, Martin Höller mar...@xss.co.at wrote:

 Am Donnerstag, 21. Januar 2010 11:54:14 schrieb eyal edri:
  so to my original question, how to i copy the files from the jar after i
  install it on the target server?

 Extract the resource files from the JAR-File using 'jar' or 'zip'
 utilities,
 and copy them to the location where you want them to be.

 This is not related to maven any more. There was actually a thread about
 something similar two days ago... and while searching for it, I found that
 you were the original poster. The last mail from Thod Tiessen [0] in this
 thread hits the nail on the head, IMHO.

 hth,
 - martin

 [0]

 http://old.nabble.com/install-maven-project-from-repository-to-local-fs-to27209691.html#a27227458




-- 
Eyal Edri


Re: best practice to include resources in the jar file and unpack them on target server

2010-01-21 Thread Lóránt Pintér
I've had a similar problem. What you can do is to use the assembly
plugin to create a separate zip or jar of your extra resources, attach
the created archive to the build with a different classifier, and
extract this artifact with the dependency plugin's unpack goal.

Lóránt

On Thu, Jan 21, 2010 at 12:52, eyal edri eyal.e...@gmail.com wrote:
 I don't agree with the conception that uber (or fat) jar is the way to go.
 IMO, you loose all the advantages maven dependency supplies if you do so (as
 i mentioned, you need to install all your application in case you change one
 line of code in one of your infrastructure jars..)

 i know maven isn't supposed to be used for deployment, but with a little
 open mind and flexibility, it can be done.

 On Thu, Jan 21, 2010 at 1:46 PM, Martin Höller mar...@xss.co.at wrote:

 Am Donnerstag, 21. Januar 2010 11:54:14 schrieb eyal edri:
  so to my original question, how to i copy the files from the jar after i
  install it on the target server?

 Extract the resource files from the JAR-File using 'jar' or 'zip'
 utilities,
 and copy them to the location where you want them to be.

 This is not related to maven any more. There was actually a thread about
 something similar two days ago... and while searching for it, I found that
 you were the original poster. The last mail from Thod Tiessen [0] in this
 thread hits the nail on the head, IMHO.

 hth,
 - martin

 [0]

 http://old.nabble.com/install-maven-project-from-repository-to-local-fs-to27209691.html#a27227458




 --
 Eyal Edri


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org