Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8189643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:20:54+00:00 2026-06-07T03:20:54+00:00

I have a multi-module maven project that must have RMI stubs generated with it

  • 0

I have a multi-module maven project that must have RMI stubs generated with it (to integrate with a legacy product that can’t use dynamic proxies). I have configured the rmic-maven-plugin to do the rmic during the compile phase, and to package the stubs jar during the package phase.

<execution>
        <id>rmic-process-classes</id>
        <goals>
          <goal>rmic</goal>
        </goals>
        <phase>compile</phase>
        <configuration>
          <keep>true</keep>
          <!--outputDirectory>${project.build.outputDirectory}</outputDirectory-->
          <includes>
            <include>com.MyImpl</include>
          </includes>
        </configuration>
      </execution>
      <execution>
        <id>rmic-package</id>
        <goals>
          <goal>package</goal>
        </goals>
        <configuration>
          <!--outputDirectory>${project.build.outputDirectory}</outputDirectory>
          <finalName>broker-dl</finalName>
          <classifier>${project.version}</classifier-->
        </configuration>
      </execution>

I run into an issue after the assembly is created in my ‘-dist’ module, which is a child module of the parent that exists to create the distribution archive. It does not include the client jar generated by the rmic-package execution.

How do I configured the assembly plugin to include the jar that the rmic plugin produces in the package phase? I tried adding a <files. section after the <moduleSets>, but when the files section is present, only those files end up in my assembly, as though the moduleSet section didn’t exist.

      <moduleSets>
      <moduleSet>
          <useAllReactorProjects>true</useAllReactorProjects>
          <includes>
              <include>com:ImplModule</include>
           </includes>
          <binaries>
              <unpack>false</unpack>
              <fileMode>644</fileMode>
              <directoryMode>755</directoryMode>
              <dependencySets>
                <dependencySet>
                  <outputDirectory>lib</outputDirectory>
                </dependencySet>
              </dependencySets>
          </binaries>
      </moduleSet>     
   </moduleSets>
   <files>
       <file>           
           <outputDirectory>lib</outputDirectory>
           <source>../ImplModule/target/ImplModule-${project.version}-client.jar</source>
           <fileMode>644</fileMode>
       </file>       
   </files>

Note: I have read a related question but creating a Stub project seems impossible, since the RMI server class from which the stub is generated clearly needs to be a part of the main application jar, not part of a Stub jar, so I don’t see how to rmic the RMI server in one module and yet javac it in another.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:20:56+00:00Added an answer on June 7, 2026 at 3:20 am

    I was able to solve this problem myself by switching from using moduleSets to a combination of fileSets and a dependencySets. The fileSets pick up the main jar for the root of the assembly, and the rmic client jar from the rmic-package goal into the lib directory. Then, the dependencySet pulls all the dependencies of the main jar into the lib directory as well.

    <!-- Include the -dl jar created by the rmic-package goal in
            the lib part of the assembly. It is necessary because 
            the target VM does not support dynamic RMI stubs, so the 
            stubs must be deployed in the assembly. -->
       <fileSets>
           <fileSet>
               <directory>../{project}/target</directory>
               <outputDirectory>.</outputDirectory>
               <!-- put the main jar in the top level -->
               <includes>
                   <include>*.jar</include>
               </includes>
               <!-- don't include the RMIC-built -dl jar at the top -->
               <excludes>
                   <exclude>*-dl-*.jar</exclude>
               </excludes>
           </fileSet>
           <fileSet>
               <directory>../{project}/target</directory>
               <outputDirectory>lib</outputDirectory>
               <!-- put the RMIC-built -dl jar in the lib dir -->
               <includes>
                   <include>*-dl-*.jar</include>
               </includes>
           </fileSet>
       </fileSets>
       <dependencySets>
           <dependencySet>
               <!-- put all the dependencies in lib, as usual -->
               <useProjectArtifact>false</useProjectArtifact>
               <outputDirectory>lib</outputDirectory>             
               <excludes>
                   <!-- don't include the main jar, which is at 
                        the top level already. -->
                   <exclude>{groupId}:{artifact}</exclude>
               </excludes>
               <unpack>false</unpack>
           </dependencySet>
       </dependencySets>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-module Maven project that makes use of WAR overlays (stack of
We have a multi-module maven project that uses a profile that defines a buildnumber-maven-plugin
I have a multi module maven project and I would like to use versions
I use eclipse and the maven plugin. I have a big multi-module project (~6
I have a Java multi-module Maven project that I want to build an MVN
I have a multi-module Maven project that is a Java web application. I am
I'm new to Maven. I have a multi-module maven 2 project that has the
I have a multi-module project in maven, where other projects need to use the
I have a maven multi-module project (boy, I've written that opening way too many
I have a multi module Spring project that I set up using Maven: my-root

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.