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 7511177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:28:02+00:00 2026-05-29T23:28:02+00:00

I have a maven project with several modules, One of these modules produces a

  • 0

I have a maven project with several modules,

One of these modules produces a custom, binary file. I need this file as input in another module.

What I want to do, is to fetch this file as dependency an use it in an other module with the help of an ant-script.

I tries a lot with Maven Assembly Plugin and dependency:copy-dependencies plugin, but with no success

Thanks for any suggestions

  • 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-05-29T23:28:03+00:00Added an answer on May 29, 2026 at 11:28 pm

    I had a very similar requirement for a project of mine. I am trying to synthesize it here, I hope this could help you :

    Let’s say that the project is structured as follow :

    projectfoo (pom)
        |- module1 (your binary dependency)
        L module2 (the module that needs your dependency)   
    

    Let’s start with the projectfoo pom :

    <groupId>com.dyan.sandbox</groupId>
    <artifactId>projectfoo</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    
    <modules>
        <module>module1</module>
        <module>module2</module>
    </modules> 
    

    Easy….

    Now the module 1 :

    <parent>
        <groupId>com.dyan.sandbox</groupId>
        <artifactId>projectfoo</artifactId>
        <version>0.0.1</version>
    </parent>
    
    <groupId>com.dyan.sandbox.projectfoo</groupId>
    <artifactId>module1</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <id>make-your-resource</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/resources.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    … and the descriptor file (src/main/assembly/resources.xml) :

    <assembly>
        <id>resources</id>
        <formats>
            <format>zip</format>
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>
        <fileSets>
            <fileSet>
                <directory>src/main/resources/</directory>
                <outputDirectory>.</outputDirectory>
            </fileSet>
        </fileSets>
    </assembly>
    

    I assume here that you have previously generated your binary resource one way or another and stored it in src/main/resources. What the code above does is just creating a zip artifact of your resource, this is a necessary step to ease its injection as a maven dependency in module2.

    So, now we just have to add this zip artifact as a dependency in module 2 :

    <groupId>com.dyan.sandbox.projectfoo</groupId>
    <artifactId>module2</artifactId>
    <version>0.0.1</version>
    
    <dependencies>
        <dependency>
            <groupId>com.dyan.sandbox.projectfoo</groupId>
            <artifactId>module1</artifactId>
            <version>0.0.1</version>
            <classifier>resources</classifier>
            <type>zip</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    

    … and finally unzip it with the maven-dependency-plugin, ideally in the classpath of module2 (target/classes) :

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-your-resource</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <!-- unzip the resources in compilation folder -->
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                            <includeArtifactIds>module1</includeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    … and that’s it !

    Yannick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have maven project with several modules. Need to deploy all modules( jars and
I have a project that consists of several modules (app. 10-12). I use maven
I have a project with several modules. When all tests pass, Maven test runs
I have a multi-module project using Maven. On one of the modules I have
In a maven project I have several modules which only have a persitence.xml for
I have several Maven modules with Vaadin library dependency in the root pom.xml file.
I have maven project that consists of several modules. I want to add an
I have a Maven project that consists of several modules. I have a single
I have a maven project that contains a certain api I need to use
I have a maven project A which uses jar files of another project B

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.