Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails 3.0.5 - 3.0.8 Using a Pathing Jar causes a Circular Dependency Error #9300

Closed
lhigginbotham opened this issue Sep 29, 2015 · 1 comment
Assignees
Milestone

Comments

@lhigginbotham
Copy link

lhigginbotham commented Sep 29, 2015

Environment:

Windows 7 64-Bit
| Grails Version: 3.0.8
| Groovy Version: 2.4.4
| JVM Version: 1.8.0_45

Reproducible Example:
https://github.com/lhigginbotham/grailspathingjarissue
When attempting to build a project using a pathing jar in Grails 3.0.5 and above, I get the following error. The code works in Grails 3.0.4.

FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:classes
\--- :compileGroovy
     \--- :launcherJar
          \--- :compileGroovyPages
               +--- :compileGroovy (*)
               +--- :compileIntegrationTestGroovy
               |    +--- :classes (*)
               |    +--- :compileIntegrationTestJava
               |    |    +--- :classes (*)
               |    |    \--- :testClasses
               |    |         +--- :compileTestGroovy
               |    |         |    +--- :classes (*)
               |    |         |    \--- :compileTestJava
               |    |         |         \--- :classes (*)
               |    |         \--- :compileTestJava (*)
               |    \--- :testClasses (*)
               \--- :compileTestGroovy (*)

(*) - details omitted (listed previously)

I'm using some code that collects all the runtime dependencies into a single jar to bypass Window's native command line string length limitations.

task launcherJar(type: Jar) {
    def gradleUserHome = new File(gradle.getGradleUserHomeDir(), "caches")

    def relativeClasspathEntries = configurations.runtime.files.collect {
        new File(gradleUserHome.getAbsolutePath()).toURI().
                relativize(new File(it.getAbsolutePath()).toURI()).getPath()
    }
    appendix = "launcher"
    destinationDir = gradleUserHome
    doFirst {
        manifest {
            attributes "Class-Path": relativeClasspathEntries.join(" ")
        }
    }
}

compileGroovy{
  dependsOn launcherJar
    FileCollection collection = files(launcherJar.archivePath);
    def finCollection = collection
    doLast {
        classpath = finCollection
    }
}

bootRun{
    doFirst{
        //The main build directories aren't collected so they are added manually
        FileCollection collection = files("${project.buildDir}/classes/main") + files("${project.buildDir}/resources/main") + files(launcherJar.archivePath)
        classpath = collection
    }
}

I'm not sure, but I think the changes for #9165 might be what has caused the issue.

@gregopet
Copy link

Can someone from the Grails' side provide any clues on how merge pathing JARs with Asset Pipeline (see the referenced issue)?

rainboyan pushed a commit to rainboyan/GoBoots that referenced this issue Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants