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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:33:21+00:00 2026-05-26T09:33:21+00:00

I have a project consisting of 3 libraries – let’s call them 1) BABY,

  • 0

I have a project consisting of 3 libraries – let’s call them 1) BABY, 2) CHILD and 3) ADULT. Lib “CHILD” depends on “BABY” and “ADULT” depends on “CHILD”.

What I want to do is produce:

  • a dev version that has all the (transitive) dependencies
  • a production version that creates a standalone JAR for each library (embedding the dependencies)

I have a profile dev and a profile release already, and I know how to use ProGuard to generate the JAR.

The question is how to tell Maven to keep all dependencies in dev and ignore them (optional/provided) in production?

  • 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-26T09:33:22+00:00Added an answer on May 26, 2026 at 9:33 am

    Here is what I used eventually:

    • The parent POM defines a profile release that configurates the proguard plugin (crates one big JAR) and the install plugin (places the release artifact in the repo).

    • The lib-baby POM simply calls the 2 plugins in the <build> section.

    • The lib-child POM additionally specifies a dev profile where the dependency to lib-baby is defined. Within the release profile this dependency has an optional tag and is included in the big JAR.

    In the end when run by default, the libs com.company.dev:lib-baby and com.company.dev:lib-child are created (included their dependencies).

    When run with -Prelease the libs com.company:lib-baby and com.company:lib-child are created (standalone libs [WITHOUT any dependencies]) – only side effect is that the default artifacts (.*dev) are overwritten 🙁

    parent:

    <project>
        <groupId>com.company</groupId>
        <artifactId>lib-parent</artifactId>
        <packaging>pom</packaging>
    
        <modules>
            <module>lib-baby</module>
            <module>lib-child</module>
            <module>lib-adult</module>
        </modules>
    
        <profiles>
            <profile>
                <id>release</id>
                <activation>
                    <property>
                        <name>release</name>
                    </property>
                </activation>
    
                <build>
                    <pluginManagement>
                        <plugins>
                            <!-- aggregate to one big jar -->
                            <plugin>
                                <groupId>com.pyx4me</groupId>
                                <artifactId>proguard-maven-plugin</artifactId>
                                <executions>
                                    ...
                                </executions>
                                <configuration>
                                    <injar>${project.build.finalName}.jar</injar>
                                    <outjar>${project.build.finalName}-release.jar</outjar>
                                    ....
                                </configuration>
                            </plugin>
    
                            <!-- install release version of artifact separately (under com.company) -->
                            <plugin>
                                <inherited>true</inherited>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-install-plugin</artifactId>
                                <executions>
                                    <execution>
                                        <id>install-release</id>
                                        <goals>
                                            <goal>install-file</goal>
                                        </goals>
                                        <configuration>
                                            <file>
                                                target/${project.build.finalName}-release.jar
                                            </file>
                                            <groupId>com.company</groupId>
                                            ...
                                        </configuration>
                                    </execution>
                                </executions>
                            </plugin>
                        </plugins>
                    </pluginManagement>
                </build>
            </profile>
        </profiles>
    </project>
    

    lib-baby:

    <project>
        <groupId>com.company.dev</groupId>
        <artifactId>lib-baby</artifactId>
        <packaging>jar</packaging>
    
        <parent>
            <groupId>com.company</groupId>
            <artifactId>lib-parent</artifactId>
        </parent>
    
        <profiles>    
            <profile>
                <id>release</id>
    
                <build>
                    <plugins>
                        <!-- produces 'lib-baby-release.jar -->
                        <plugin>
                            <groupId>com.pyx4me</groupId>
                            <artifactId>proguard-maven-plugin</artifactId>
                        </plugin>
    
                        <!-- installs 'lib-baby-release.jar -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-install-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-release</id>
                                    <phase>install</phase>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    </project>
    

    lib-child:

    <project>
        <groupId>com.company.dev</groupId>
        <artifactId>lib-child</artifactId>
        <packaging>jar</packaging>
    
        <parent>
            <groupId>com.company</groupId>
            <artifactId>lib-parent</artifactId>
        </parent>
    
        <profiles>
            <profile>
                <id>dev</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
    
                <dependencies>
                    <dependency>
                        <groupId>com.company.dev</groupId>
                        <artifactId>lib-baby</artifactId>
                    </dependency>
                </dependencies>
            </profile>
    
            <profile>
                <id>release</id>
    
                <dependencies>
                    <dependency>
                        <groupId>com.company.dev</groupId>
                        <artifactId>lib-baby</artifactId>
                        <version>1.0</version>
                        <!-- made optional because will be embedded in standalone jar -->
                        <optional>true</optional>
                    </dependency>
                </dependencies>
    
                <build>
                    <plugins>
                        <!-- produces 'lib-child-release.jar -->
                        <plugin>
                            <groupId>com.pyx4me</groupId>
                            <artifactId>proguard-maven-plugin</artifactId>
                            <configuration>
                                <assembly>
                                    <inclusions>
                                        <inclusion>
                                            <groupId>com.company.dev</groupId>
                                            <artifactId>lib-baby</artifactId>
                                        </inclusion>
                                    </inclusions>
                                </assembly>
                            </configuration>
                        </plugin>
    
                        <!-- installs 'lib-child-release.jar -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-install-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-release</id>
                                    <phase>install</phase>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project consisting of four programs for different platforms; all of them
We have a project P ( C/C++ on Linux) consisting of libraries lib1 ,
I have a project consisting of a windows client (approx. 150 users), a webservice
(By the way, I don't use Interface Builder) I have a little project consisting
I have project I want to upgrade to .Net4 and it use BackgroundCopyManager.dll. Anyone
I have a project consisting of three projects, WCF service Asp.net MVC 3 application
Basically, I have a multi-module project consisting of 5 different modules. One of the
I have a Java project (in Eclipse) consisting of several packages. I would like
I have small project consisting of one maven project and two maven modules. One
I have a C# project consisting of stored procedures that reference a win32 dll

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.