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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:18:59+00:00 2026-05-23T16:18:59+00:00

I have project that depends on commons-httpclient [2.0] (compile). I would like to write

  • 0

I have project that depends on commons-httpclient [2.0] (compile).

I would like to write some jbehave tests – jbehave-core 3.4.5 (test).
Both this dependencies depend on commons-lang but in different versions – 1.0.1 and 2.5.

dependency

When I execute mvn package I get [BUID FAILURE] in tests section.
There is an exception for my testcase in surefire-plugin output:

java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.substringBeforeLast(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

As I looked in source code – in commons-lang 1.0.1 – indeed, there is no StringUtils.substringBeforeLast(…) method.
Why maven uses commons-lang from commons-httpclient (compile) and not from jbehave-core in testing?

I can’t afford to exclude this conflicting dependency in commons-httpclient so it must stay in compile time.

So how can this be resolved – commons-lang 2.5 version in testing and 1.0.1 in compile time?

  • 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-23T16:19:00+00:00Added an answer on May 23, 2026 at 4:19 pm

    Maven 3:

    Maven 3 will attempt to obtain the nearest dependency, effectively ensuring that only one of the compile or test scoped dependency is used for both the compile and test phases.

    (Thanks Vineet Reynolds)

    Maven 2 (OLD):

    try to define 2 different <dependency> tags with different versions and scopes. Use tag <scope>test</scope> inside dependency for tests and <scope>compile</scope> for compilation.

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

Sidebar

Related Questions

I have a project that depends upon some other binaries to be downloaded from
Suppose, I have an opensource project that depends on some library, that must be
I have a project that I would like to start beta testing soon, it
I have a Maven project that looks like the following: - enterprise-pom - commons
I have a project A that depends on project B that depends on project
I have an Android project that depends on an android library (apklib) project. The
I have a project that contains several submodules, that communicate using some objects that
So I have a project that depends on a snapshot version of another project.
I have a python project that depends on another project that depended on python-dateutil.
I have a legacy war project that depends on a jar project, the jar

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.