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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:17:08+00:00 2026-06-10T20:17:08+00:00

I am attempting to compile several WAR files, all that depend on a common

  • 0

I am attempting to compile several WAR files, all that depend on a common JAR module. In my Gradle build however, I cannot seem to get a ‘Provided’ like dependency to work with the Java plugin.

My compile looks like this:

apply plugin: 'java'
configurations{
    providedCompile
}

dependencies {
    compile module("org.springframework.amqp:spring-amqp:${springAmqpVersion}")
    compile module("org.slf4j:slf4j-api:${slf4jVersion}")
    compile module("org.slf4j:slf4j-ext:${slf4jVersion}")

    providedCompile "javax.servlet:servlet-api:${servletApiVersion}"

    runtime module("org.slf4j:jcl-over-slf4j:${slf4jVersion}")
    runtime module("org.slf4j:jul-to-slf4j:${slf4jVersion}")
    runtime module("org.slf4j:log4j-over-slf4j:${slf4jVersion}")

    sourceArchives module("org.springframework.amqp:spring-amqp:${springAmqpVersion}:sources")
    sourceArchives module("javax.servlet:servlet-api:${servletApiVersion}:sources")
}


sourceSets {
    main { compileClasspath += configurations.providedCompile }
}

However, that last bit is where it gets an exception. I have tried adding the servlet-api (Provided by Tomcat) to the configuration after the runtime dependencies would extend it, or simply putting it in as a compile module, then removing it from runtime dependencies later.

I’ve attempted several different ways of modifying the dependencies, with my closest results being:

newRuntime = configurations.runtime.minus(configurations.providedCompile)
configurations.runtime = newRuntime

This last bit however, will generate the variable newRuntime with the proper dependencies, however when I tried to reassign the variable back to the runtime configuration, it throws a “Cannot find property exception”

I found a lot of discussion of this exact problem on Gradle’s bug tracking:Gradle-784

However the main lead from that is from Spring who uses Maven with their gradle builds, which I am unfamiliar with.

The most promising link I found here on SO, but unfortunately I could not get the examples to work as well: SO Provided Question
Of note for the Stack Overflow question the line that showed most promise:

//Include provided for compilation
sourceSets.main.compileClasspath += configurations.provided

This line does not give an error like other attempts, however it appears that the providedCompile (My version of provided) dependency is not actually put on the compile classpath, as there is a classpath error when compilation is attempted.

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

    I’m not 100% following your message but providedCompile is only allowed for ‘war’ plugin.

    apply plugin: 'war'
    
    dependencies {
      // others go here
      providedCompile "javax.servlet:javax.servlet-api:${servletVersion}"
    }
    

    During ‘war’ step the servlet jar is not included.

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

Sidebar

Related Questions

I am attempting to compile some code, but am running into some problems that
I'm having all manner of trouble attempting to compile Adobe Source Libraries (ASL) on
I'm attempting to compile SndObj, and I need some header files. Which Debian packages
I'm attempting to compile some C# with gmcs version 2.11.0 that includes System.Tuple. Supposedly
In attempting to compile ICU49 using Android NDKv7b, I ran into the following: /home/tim/icu49/icu/source/common/putil.cpp:
I have some .cs files that are shared amongst several projects and if possible
I'm attempting to compile a file that instantiates this class. GCC gives me cryptic
I'm attempting to compile a sample c file that was given to me, but
I'm attempting to compile Java 1.4 code that was created by IBM's WSDL2Java on
I am attempting to compile C code that utilizes the following within GNU readline.

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.