* External Email - Caution * |
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/WjJCKeBLEFw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/DM6PR02MB671570C37DE2678E457E1196FEA79%40DM6PR02MB6715.namprd02.prod.outlook.com.
How are you building the plugin, i.e. how are you invoking Gradle to actually create the plugin jar?
Does your plugin jar contain the file META-INF/xnat/ASHS-Plugin-plugin.properties or at least something matching the pattern META-INF/xnat**/*-plugin.properties?
That properties file is generated from @XnatPlugin-annotated classes and is used by XNAT at run-time to identify installed plugins. If that’s not there, you’d see behavior like you’re describing.
The reason ${project.version} doesn’t work to resolve the XNAT dependencies is because project refers to the current project (i.e. your plugin) and its version, which is set to 1.0.0-BETA*. In the template plugin the version is tied to the XNAT version, so that works. We should probably change that because I see how it’s misleading, but the issue isn’t because there’s some inherent difference between ${project.version} and ${vXnat} in terms of how Gradle interprets the values.
* The dependency resolution mechanisms for Gradle and Maven don’t really understand BETA as a suffix for version numbers. The standard practice is to use SNAPSHOT instead, which Maven/Gradle/Ivy treat in a special way during publishing (tl;dr artifacts get published with a timestamp like 1.0.0-20210927101427-10, with a metadata file mapping 1.0.0-SNAPSHOT to a particular artifact by timestamp). This probably doesn’t matter too much for local development purposes on an in-house development project, but if/when you make the plugin publicly available it could become an issue.
--
Rick Herrick
Sr. Programmer/Analyst
Neuroinformatics Research Group
Washington University School of Medicine
Phone: +1 (314) 273-1645
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/CACdbfcGdXsbcsfSddgrM_VaZCNXoV%2BgZCghmKF9mqoFqNgOOew%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/SN6PR02MB511837A0CC72AD07F88812F5BDA79%40SN6PR02MB5118.namprd02.prod.outlook.com.
Try using xnatDataBuilder:
./gradlew clean xnatDataBuilder
The lack of a properties file in the plugin wouldn’t prevent XNAT from finding the data types–as long as the schema files are on the classpath, XNAT should find them–but they won’t be configured and made available automatically: that requires the @XnatDataModel annotations in the plugin class, e.g. from xnat-template-plugin:
@XnatPlugin(value = "templatePlugin", name = "XNAT Template Plugin",
entityPackages = "org.nrg.xnat.plugins.template.entities",
dataModels = {@XnatDataModel(value = TemplateSampleBean.SCHEMA_ELEMENT_NAME,
singular = "Template",
plural = "Templates",
code = "TM")})
Without that annotation (or whatever values are appropriate for your data type), the data type gets loaded by XNAT, but you’ll need to go to Administer -> Data Types on the site admin menu to set up the data type manually.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/CACdbfcHr_XHsGaY9umb3MikpoBVrZD%2BrnN4%2Bs1acX5G%2BgDuWNA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/SN6PR02MB51182DA7064AB65B35FD7460BDA79%40SN6PR02MB5118.namprd02.prod.outlook.com.
Yes, that was going to be my next suggestion. The fact that the database wasn’t updated is the tip-off: like I said earlier, XNAT will find the schema files without any help from the plugin at all, provided the schema files are actually there! 😊 That excluded configuration was there to resolve an issue where the jar task would fail because it found two copies of the same file path to be added to the jar file. That fixed the issue at that point, but the other change of removing src/main/resources (which is included automatically without configuring it) caused it to exclude even the copies of the schema files.
Have a look at the latest version of the template plugin: https://bitbucket.org/xnatx/xnat-template-plugin/src/master
The sourceSets configuration has actually been removed altogether (although it is referenced in the sourcesJar configuration).
--
Rick Herrick
XNAT Architect/Developer
Computational Imaging Laboratory
Washington University School of Medicine
From:
xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Santiago Timón <santiago...@gmail.com>
Date: Tuesday, September 28, 2021 at 6:04 AM
To: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com>
Subject: Re: [XNAT Discussion] Problems to build a new plugin from the XNAT template plugin
* External Email - Caution * |
Hi again,
I'm still investigating this problem and I think I found the reason XNAT doesn't see the data types: they are not being packaged in the jar. This seems to be caused by an excluded block in build.graddle.
Graddle is missing the resources folders for schemas and template-related files.
Compared to our other plugin jar:
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/CACdbfcGAQORjrqOmnG6htd%3Dj%3DWRF295P0m5ScwLSxiRWEV-frw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/SN6PR02MB5118E828592FA1F5FB39736ABDA89%40SN6PR02MB5118.namprd02.prod.outlook.com.