Tried making my top-level module dependent on all the others so the assembly invoked there would run last. Unfortunately, it seems the dependencies are inherited to all the children, and Maven complains about dependencies upon self.

I presume there's an obvious idiom that I just haven't yet beaten into my head.

Checked in on xalan-java branch xalan-java-mvn-refactored with bin assembly commented out, if anyone wants to see it in context.


On 11/10/2023 9:37 PM, Joseph Kessselman wrote:
Oh. I probably forgot to set dependencies. Checking.


On 11/10/2023 9:35 PM, Joseph Kessselman wrote:
I'm trying to adapt the examples given at https://maven.apache.org/plugins/maven-assembly-plugin to work with my multi-module project.

Source was mostly easy -- I copied the <assembly/> into a file, tweaked its excludes (still wish it picked up the .gitinclude automagically), and it worked. I'd still like to change which directory the resulting archive files were written to, but that's a nitpick; maybe I can copy 'em to the "ant simulation" build/ directory afterward.


But binary is giving me a bit more trouble. This is working for others, so I presume it's another case of my just not understanding the idiom well enough.


All I did was add one more <descriptor/> to reference
src/assembly/bin.xml, and dropped there a copy of the <assembly>
taken from the page, modified to output to tar.gz and zip. I changed the
<include>s to reference my artifacts, and ran mvn package again.

Maven objects to my first child module:

 > [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.6.0:single (make-assembly) on project xalan-project: Failed to create assembly: Artifact: xalan:serializer:jar:2.7.3 (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated. -> [Help 1]


This confuses me. There is indeed a file there,
serializer/target/serializer-2.7.3.jar, which xalan:xalan seems to successfully use as the artifact for further compilation. Why isn't
maven-assembly-plugin finding and using it?

If I take out the <includes/> section entirely (trying to rely on defaults), I get the same error message.

Does a <binaries/> assembly need to be put on a later phase? Or a different execution?


Any advice would bemore than welcome...!


In my pom.xml, last plugin before </plugins></build>:
...
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <version>3.6.0</version>
     <inherited>false</inherited>
         <configuration>
           <descriptors>
             <descriptor>src/assembly/src.xml</descriptor>
         <descriptor>src/assembly/bin.xml</descriptor>
           </descriptors>
         </configuration>
     <executions>
           <execution>
             <id>make-assembly</id> <!-- this is used for inheritance merges -->
             <phase>package</phase> <!-- bind to the packaging phase -->
             <goals>
               <goal>single</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
...

And my bin.xml:

<!-- Maven assembly plugin configuration for executable packaging -->

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd";>
   <id>bin</id>
   <formats>
     <format>tar.gz</format>
     <format>zip</format>
   </formats>
   <includeBaseDirectory>true</includeBaseDirectory>
   <moduleSets>
     <moduleSet>
       <!-- Enable access to all projects in the current multimodule build! -->
       <useAllReactorProjects>true</useAllReactorProjects>

       <!-- Now, select which projects to include in this module-set. -->
       <!-- <includes> -->
       <!--     <include>xalan:serializer</include> -->
       <!--     <include>xalan:xalan</include> -->
       <!--     <include>xalan:samples</include> -->
       <!--     <include>xalan:xalan2jtaglet</include> -->
       <!--     <include>xalan:xalan-project</include> -->
       <!-- </includes> -->
       <binaries>
         <outputDirectory>modules/maven-assembly-plugin</outputDirectory>
         <unpack>false</unpack>
       </binaries>
     </moduleSet>
   </moduleSets>
</assembly>

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

Reply via email to