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 '-db.zip' artifact. What kind of files does it contain?
Hi, Nikolay Chashnikov.
'-db.zip' 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 db.zip 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 com.haulmont.studio.intellij.projectresolve.CubaProjectDataService#importData.
Thanks for the help.