plantuml-gradle-plugin icon indicating copy to clipboard operation
plantuml-gradle-plugin copied to clipboard

Not compatible Android Studio gradle

Open wjtxyz opened this issue 3 years ago • 5 comments

Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'compileClasspath' not found. at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:160) at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:332) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:150) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:63) at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getAt(DefaultNamedDomainObjectCollection.java:352) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getAt(DefaultConfigurationContainer.java:63) at org.gradle.api.artifacts.ConfigurationContainer$getAt.call(Unknown Source) at com.github.roroche.plantuml.urls.CompileClasspathUrls.(CompileClasspathUrls.groovy:26) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask.getClassLoader(BuildClassDiagramTask.groovy:81) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask_Decorated.getClassLoader(Unknown Source) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask.execute(BuildClassDiagramTask.groovy:54) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:717) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:684) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)

Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'main' not found. at org.gradle.api.internal.DefaultNamedDomainObjectCollection.createNotFoundException(DefaultNamedDomainObjectCollection.java:503) at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:332) at org.gradle.api.NamedDomainObjectCollection$getByName.call(Unknown Source) at com.github.roroche.plantuml.urls.MainOutputUrls.(MainOutputUrls.groovy:39) at com.github.roroche.plantuml.urls.MainOutputUrls.(MainOutputUrls.groovy:27) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask.getClassLoader(BuildClassDiagramTask.groovy:86) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask_Decorated.getClassLoader(Unknown Source) at com.github.roroche.plantuml.tasks.BuildClassDiagramTask.execute(BuildClassDiagramTask.groovy:54) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:717) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:684)

wjtxyz avatar Feb 24 '21 08:02 wjtxyz

Have you gotten anywhere on this? I'm having a similar issue.

dpfannenstiel avatar Mar 22 '21 17:03 dpfannenstiel

Have you gotten anywhere on this? I'm having a similar issue.

No :(

wjtxyz avatar May 24 '21 09:05 wjtxyz

Were you attempting to document a framework? Because I was. I reached the conclusion that the error SourceSet with name 'main' not found indicated that the plugin was unable to find an entry point to the code to start building the documentation. As I dug into the source, it looks like there's no way for the user to change that. We'd have to modify the project.

dpfannenstiel avatar May 24 '21 14:05 dpfannenstiel

I have a similar problem with Android Studio Chipmunk | 2021.2.1 Patch 2.

I started a new project from the template Basic Activity: image

To the project-level build.gradle file I had to add (this is not in the plugin documentation):

plugins {
    id ' java'
}

configurations {
    compileClasspath
}

But then I finally get Invalid package 'com.example.myapplication', maybe missing or empty which is implying that the reflection used to find the packages isn't working.

./gradlew buildClassDiagram
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :buildClassDiagram FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildClassDiagram'.
> Invalid package 'com.example.myapplication', maybe missing or empty

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

EDIT

Here's my My\Application\build.gradle finally:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.2' apply false
    id 'com.android.library' version '7.2.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
    id "com.github.roroche.plantuml" version "1.0.2"
    id 'java'
}

//task clean(type: Delete) {
//    delete rootProject.buildDir
//}

configurations {
    compileClasspath
}

classDiagram { // (1)
    packageName = "com.example.myapplication" // (2)
    outputFile = project.file('diagrams/class_diagram.plantuml') // (3)
    // outputFile = new File("${projectDir}/diagrams/class_diagram.plantuml") // (4)
//    ignoredClasses = [ // (5)
//                       "com.github.roroche.plantuml.diagrams.Diagram\$Simple",
//                       "com.github.roroche.plantuml.diagrams.Diagram\$Wrap",
//                       "com.github.roroche.plantuml.classes.Classes\$Simple",
//                       "com.github.roroche.plantuml.classes.Classes\$Wrap"
//    ]
}

fuhrmanator avatar Aug 21 '22 14:08 fuhrmanator

I forked and rewrote the plugin and did my best to make it compatible with Android Studio: https://plugins.gradle.org/plugin/io.gitlab.plunts.plantuml

I'm open for suggestions if anything is still not working, since I actually don't use Android Studio myself.

Plunts avatar Jan 02 '23 18:01 Plunts