Spring Tool Suite
  1. Spring Tool Suite
  2. STS-2063

When importing a WTP project the Gradle Classpath container should be added to the component assembly

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 2.8.0.M1
    • Fix Version/s: 2.8.0.M2
    • Component/s: GRADLE
    • Labels:
      None

      Description

      That is, when a project 'looks like' a WTP project because it already has WTP eclipse configuration file. Then when we convert it to a Gradle project and add the classpath container, we should also add the classpath container to the project's component assembly.

        Activity

        Hide
        Kris De Volder (c) added a comment - - edited

        I'll be raising another API enhancement request against Gradle to be able to get info on the kinds of dependency a jar represents. (edit: issue = http://issues.gradle.org/browse/GRADLE-1777)

        Until I have some way to get that info there isn't a good way to exclude,
        providedXXX dependencies from the deployment assembly.

        However as a stop gap measure, I could exclude specific jars based on their names from the Deployment assembly.

        Besides servlet-api.jar, any other jars that I should exclude?

        Show
        Kris De Volder (c) added a comment - - edited I'll be raising another API enhancement request against Gradle to be able to get info on the kinds of dependency a jar represents. (edit: issue = http://issues.gradle.org/browse/GRADLE-1777 ) Until I have some way to get that info there isn't a good way to exclude, providedXXX dependencies from the deployment assembly. However as a stop gap measure, I could exclude specific jars based on their names from the Deployment assembly. Besides servlet-api.jar, any other jars that I should exclude?
        Hide
        Rob Winch (c) added a comment -

        The servlet-api-<version>.jar, javax.servlet-api-<version>.jar, and jsp-api-<version>.jar jars are the provided dependencies that should not be deployed to a war (there may be more but excluding these should ensure Spring Security works).

        I'm doubting you were also looking for test dependencies as I don't think these would prevent an application from running. However, just in case here are a few test dependencies that are almost certainly not going to be in a war spock*.jar, junit*.jar, spring-text*.jar, testng*.jar, mockito*.jar, jwebunit*.jar, selenium*.jar, htmlunit*.jar, and geb*.jar

        I really appreciate all your efforts on this. Thanks again!

        Show
        Rob Winch (c) added a comment - The servlet-api-<version>.jar, javax.servlet-api-<version>.jar, and jsp-api-<version>.jar jars are the provided dependencies that should not be deployed to a war (there may be more but excluding these should ensure Spring Security works). I'm doubting you were also looking for test dependencies as I don't think these would prevent an application from running. However, just in case here are a few test dependencies that are almost certainly not going to be in a war spock*.jar, junit*.jar, spring-text*.jar, testng*.jar, mockito*.jar, jwebunit*.jar, selenium*.jar, htmlunit*.jar, and geb*.jar I really appreciate all your efforts on this. Thanks again!
        Hide
        Kris De Volder (c) added a comment -

        OK I'll add some preferences page to allow configuring a list of these kinds of exclusion patterns... and I'll configure them by default with provided list. Once we have better way of doing it right, I expect to remove all of this again .

        Show
        Kris De Volder (c) added a comment - OK I'll add some preferences page to allow configuring a list of these kinds of exclusion patterns... and I'll configure them by default with provided list. Once we have better way of doing it right, I expect to remove all of this again .
        Hide
        Kris De Volder (c) added a comment -

        A fix is now complete and committed. It uses a list of globally defined Java regexp patterns to determine which jars should not be deployed.

        The list is configured with these defaults:

        					
        servlet-api-.*\.jar 
        javax.servlet-api-.*\.jar 
        jsp-api-.*\.jar
        

        I didn't add any of the mentioned 'test' jars because I thought it best to keep this list as small as possible.
        Mainly, because, if it were to accidentally capture things that should actually be deployed, it could lead to some very unintuitive 'class not found' exceptions.

        Thus I've only excluded the jars that seem to actually break the app when it is running on the server.

        If you are not happy with the list of exclusions as is, it can be edited via a preferences page under "Preferences >> Gradle >> WTP".

        I can add more items to default, but I do worry about adding something like "geb.*\.jar" because its only three letters so the risk of an accidental mismatch could be quite high.

        Show
        Kris De Volder (c) added a comment - A fix is now complete and committed. It uses a list of globally defined Java regexp patterns to determine which jars should not be deployed. The list is configured with these defaults: servlet-api-.*\.jar javax.servlet-api-.*\.jar jsp-api-.*\.jar I didn't add any of the mentioned 'test' jars because I thought it best to keep this list as small as possible. Mainly, because, if it were to accidentally capture things that should actually be deployed, it could lead to some very unintuitive 'class not found' exceptions. Thus I've only excluded the jars that seem to actually break the app when it is running on the server. If you are not happy with the list of exclusions as is, it can be edited via a preferences page under "Preferences >> Gradle >> WTP". I can add more items to default, but I do worry about adding something like "geb.*\.jar" because its only three letters so the risk of an accidental mismatch could be quite high.
        Hide
        Rob Winch (c) added a comment -

        Thanks Kris. I was able to validate that this allows deploying the Spring Security samples.

        Show
        Rob Winch (c) added a comment - Thanks Kris. I was able to validate that this allows deploying the Spring Security samples.

          People

          • Assignee:
            Kris De Volder (c)
            Reporter:
            Kris De Volder (c)
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: