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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:43:02+00:00 2026-06-11T20:43:02+00:00

I use Apache Maven to manage my Java libs (jar) and some of projects

  • 0

I use Apache Maven to manage my Java libs (jar) and some of projects that use the libs. For convinience, I use mvn eclipse:eclipse to generate Eclipse project files which can be imported into Eclipse workspace for editing.

Problems arise when I edit the main project and Java lib projects in the same Eclipse workspace. That is, mvn eclipse:eclipse includes src path dependency in .classpath file, not the jar dependency as expected.

Say I have a Jave lib project named mylib. The corresponding jar file mylib.jar has been deployed to a private Maven repo maintained by me. In order to use mylib.jar in the main project, the following dependency is included in pom.xml.

<!-- pom.xml for the main project -->
<dependency>
  <groupId>namespace.my</groupId>
  <artifactId>mylib</artifactId>
  <version>[1.0, )</version>
</dependency>

mvn compile and mvn test work perfect, in which mylib.jar is automatically downloaded from my repo. However, when trying mvn eclipse:eclipse, I find the generated .classpath file doesn’t include mylib.jar dependency as expected. Instead, it includes source file directory for mylib as follows.

<!-- .classpath file generated by mvn eclipse:eclipse -->
<classpathentry kind="src" path="/mylib"/>

It seems that Maven reads Eclipse’s metadata and finds mylib and the main project coexits in the same workspace. Therefore maven includes the source for my good. Damn. How can I tell maven to ignore the local project source and just include the jar file?

  • 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-11T20:43:03+00:00Added an answer on June 11, 2026 at 8:43 pm

    I believe this is actually because they’re related projects in Eclipse. So if you right-click on your main project and go to Project References your lib project should be ticked.

    If you run mvn eclipse:eclipse it will automatically add project references for any sub-projects (modules). You can change this with the useProjectReferences property of the maven eclipse plugin.

    It defaults to true, but

    When set to false, the plugin will not create sub-projects and instead
    reference those sub-projects using the installed package in the local
    repository

    To use the property either set the property in your pom.xml

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <useProjectReferences>false</useProjectReferences>
                </configuration>
            </plugin>
        <plugins>
    <build>
    

    Or as a property on the command line:

    mvn eclipse:eclipse -Declipse.useProjectReferences=false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use hudson to build a maven-java project. Some of my integration
When I try and generate the Eclipse project files using mvn eclipse:eclipse I get
I'm trying to use Maven to create an executable jar file that includes the
I'm having trouble getting maven to compile a project that uses Java annotations. I
I've got some problems using Maven on this ready-to-use project: http://wiki.javaforum.hu/display/ANDROIDSOAP/Home Basically, I just
I use Eclipse (Indigo) with the M2E plugin for maven. Now for some reason
I'm new to Maven, and am trying to use it to generate the Java
I'm migrating our Java EE project to use Maven instead of Ant. For the
So I use apache HttpComponents to handle http request in java. Now I want
I'm trying to use Apache XMLRPC to manage posts at a small weblog service.

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.