Processing library with custom artifact type


The project has a library whose artifacts are supplied as *.jar and as *.zip. Can the artifact with the *.zip extension be displayed in the tree in the ‘External Libraries’ section of the Gradle nodes?

How to get this artifact and files from it through the API. For example,

VirtualFile [] files = library.getFiles (OrderRootType.SOURCES);

So I can get the source files that are in the artifact * .jar
Is there a way to get the source files from the * .zip artifact?

In gradle caches, they are in the same folder as the version.


'sources' classifier is the standard one, so IntelliJ IDEA automatically adds it to the library configuration when the project is imported from Gradle, so you can access it via API and see in 'External Libraries'. However it doesn't know about '' artifact. What kind of files does it contain?


Hi, Nikolay Chashnikov.

'' artifact mainly contains folders, sql and groovy scripts.



So, how to get this artifact using API? Sort of:

VirtualFile [] files = library.getFiles (ZipArtifactOrderRootType.getInstance());

where 'ZipArtifactOrderRootType' is an implementation from 'OrderRootType'. Where to write logic to search for these files?


You would also need to extend code which imports project configuration from Gradle to IntelliJ IDEA, and I doubt that it's possible to add support for non-standard root types to it.

How that artifact is related to the library? How is it used in the Gradle scripts? If it just contains resources, why not put them into a regular JAR artifact?


Sorry for the long answer.

I found a solution. I wrote a custom org.jetbrains.plugins.gradle.tooling.ModelBuilderService and load my artifact force and set my model in

Thanks for the help.


Please sign in to leave a comment.