On 22/09/2010 2:28 PM, Iron Eagle wrote:
Hi,

thanks. Thats a good idea. I'll keep that in mind.

I am not very familiar with that package method. Are there any disadvantages? 
What about files, that have the same filename and are stored in the same folder 
in two or more dependencies. Won't one file overwrite the other?
Yes.
You have to make sure that you deal with that. It is not usually a problem but the CXF guys did something silly with their properties files but fortunately created a proper aggregated project that included a set of correctly merged property files that work with a single CXF library jar. I believe that your project's file will take precedence and the duplicates will be skipped.
We use over 50 third party libraries and have not had any problems so far.
For many of the common situations where identically named files are possible, it is better to have just ours. We do not want all the log4j.property files to be included, just the one that our project includes.

So far the benefits of simplicity in the build - pure out-of-the-box Maven - outweigh the issues since we have not seen any yet. So far we have 3 batch jobs that are part of our 60 project application and 2 have to be deployed by clients from their servers. The ability to give a system manager a jar and a 2 line batch job has avoided a lot of discussion about what each of the jars in the library does and questions about open source, licensing and security. Not that these questions are resolved by packaging. It just makes it easier to tell senior management that the application is 1 jar and a batch job and the jar comes from us. Everyone is less nervous.

the assembly file is:
<assembly>
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping></outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>

</assembly>

POM includes this in the build. Probably more than it needs and some not quite right but it works and we did not have to do anything more than configure it.
Some people in the forum could probably fix this up in their sleep.

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>jar-with-dependencies-assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.someclass.Main</mainClass>
<packageName>com.someclass</packageName>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${pom.url}</url>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>

This produces a 40Mb Jar with 25,000 files in it.
The files come from about 50 vendors/projects.


Ron



-------- Original-Nachricht --------
Datum: Mon, 20 Sep 2010 15:09:45 -0400
Von: Ron Wheeler<[email protected]>
An: [email protected]
Betreff: Re: write dependencies into file during assembly
   Can you not make your application program into a single jar
"jar-with-dependencies" and avoid all this?

That is much easier to make and distribute - maven assembly.

It looks a lot more polished than an application that sprays dozens on
files onto the disk.

Ron


On 20/09/2010 2:52 PM, Iron Eagle wrote:
Hi,

thanks for your awnser. I want to create a script, that calls another
binary (jsvc, that is also included in the assembly). That binary starts the
actual java program as a service. But the binary needs special parameter.
The classpath among other things. So I need to include the filename of all
depending jar files, to be able to build a string for the classpath.
I'll check the plugins, you suggested

greetings

Depending on what you want to do, you seem to want to use a dedicated
plugin, instead of what seems like hand-coding standard things?
You seem to want to create an executable jar?
What does your script contain, is it something very special or just a
java
command for example?

If so, there's many solutions for you (exec-maven-plugins,
maven-shade-plugin...).

If you give more details, we'll be able to help you better.

Cheers

2010/9/20 Iron Eagle<[email protected]>

Hi,

I have a maven project, that includes an assembly step in its
lifecycle
(during package). I copy the dependencies of the project in a lib/>   >
  >   folder.
Additional, copy a script file into a bin/ folder. That scripts should
start the jvm and the application later.

Now, I want to include the filenames of the depdendencies into the
script
file in order to extend the classpath when starting the jvm.

Is that possible? Can anyone help me?

best regards
Luis
--
GMX DSL SOMMER-SPECIAL: Surf&   Phone Flat 16.000 für nur 19,99
Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


--
Baptiste<Batmat>   MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to