It still doesn't work when I include the <plugin></plugin> in my batch's POM
(it can't find the descriptor)

If I include it in my super POM, the error message is :

Failed to create assembly: Error creating assembly archive: You must set at
least one file.

2007/7/18, John Casey <[EMAIL PROTECTED]>:

I think you might be better off using a dependencySet in your
assembly descriptor, and specifying the plugin configuration from the
sample_batch module, not in the sample_pom level.

The assembly descriptor would probably look something like this:

<assembly>
   <id>batch</id>
   <formats>
     <format>zip</format>
   </formats>

   <includeBaseDirectory>false</includeBaseDirectory>

   <dependencySets>
     <dependencySet>
       <outputDirectory>lib</outputDirectory>
     </dependencySet>
   </dependencySets>

   <fileSets>
     <fileSet>
       <directory>src/main/resources</directory>
       <outputDirectory>/</outputDirectory>
     </fileSet>
   </fileSets>
</assembly>

Now, if you put this in the sample_batch POM using something like the
following, you should be able to build the zip archive along with any
normal build:

<project>
   [...]

   <build>
     <plugins>
       [...]

       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <!-- It's good practice to be very explicit about the plugin
version you want. -->
         <version>2.2-beta-1</version>

         <executions>
           <execution>
             <id>batch-assembly</id>
             <phase>package</phase>
             <goals>
               <goal>single</goal>
             </goals>
             <configuration>
               <descriptors>
                 <descriptor>src/assembly/batch.xml</descriptor>
               </descriptors>
             </configuration>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>
</project>

Hope that helps,

--john

On Jul 18, 2007, at 4:48 AM, Rodolphe Beck wrote:

> Hello,
>
> I'm trying to manage a bunch of modules with maven. I currently
> have ear
> projects, simple java projects, web projects and batch projects.
> For the
> first ones, I have no problem, but for the batch ones i'm having some
> issues.
>
> Here is what I want :
>
> I have one batch project that will be used to launch operations on
> databases, basically, the .sh will be placed on crontab ant
> periodically
> launch a jar file that contains the code to run.
>
> Here is how I created my projects:
> Sample_pom : contains the superpom (in order to edit it easily with
> eclipse)
> Sample_batch : contains the batch in src/main/resources
> Sample_java : contains one java class
>
> Sample_java is in Sample_batch's dependencies.
>
> My packaging is simple : I want a zip file containing the .sh file
> at the
> root and the jar(s) in a 'lib' folder.
>
> I managed to create such a file, but it is not perfect, here are my
> two main
> issues:
>
> First I couldn't put the <plugin></plugin> to invoke assembly
> plugin in the
> pom of the batch project as an error message is fired telling it
> can't find
> the descriptor, i I put the plugin part in the superpom and the
> descriptor
> in my project:
>
> http://paste2.org/p/4892
>
> Second, my .zip is created in the target directory of the Sample_pom
> project, I'd rather have it in the target directory of Sample_batch
> project,
> is it possible ?
>
> Third, my zip contains a folder named Sample_batch-1.0-SNAPSHOT.jar
> and I
> couldn't get rid of it (descriptor included)
>
> http://paste2.org/p/4893
>
> As you see, I tried to exclude * in binaries but the folder is
> still here...
>
> Thanks for your help !
>
> --
> Cordialement/Regards,
> Rodolphe Beck
> [EMAIL PROTECTED]

---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john





--
Cordialement,
Rodolphe Beck
[EMAIL PROTECTED]

Reply via email to