On Thu, Apr 7, 2016 at 9:34 AM, Thomas Mortagne <[email protected]> wrote: > So the question is do you want the version of your module or do you > want the version of the product since those might not be in sync > (anyone can do a product based on some version of XWiki platform). > What you saw on > https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running > is the version of the product. > > If the goal is to set something like the version of "XWiki" then what > is described on > https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running > is not what you want. What you need is the version of you own > extension basically and you can do that by asking Extension Manager > the version of the installed extension with the id of your module. > > @Inject > private CoreExtensionRepository coreExtensionRepository; > ... > CoreExtension myself = > this.coreExtensionRepository.getCoreExtension("org.xwiki.commons:xwiki-commons-somehttpmodule") > Version version = myself.getId().getVersion() > > The import issue you have is probably because you are missing > xwiki-commons-extension-api dependency in your pom.xml. > > Another more Java standard approach would be to get the version from > the MANIFEST which would be much easier... if we did not forget to > configure Maven to set the version in the MANIFEST (just noticed it). > It would be something like > this.getClass().getPackage().getSpecificationVersion(). I guess this > would require a different discussion on the mailing list, will send a > mail about that. > Note that we have the version in the MANIFEST but in a custom field > set by the bundle plugin (Bundle-Version) and I would really prefer > using it in a more standard location.
See http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki81M2#HStandardjava.lang.Packageproperties. > > On Thu, Apr 7, 2016 at 12:41 AM, Sean Whalen <[email protected]> wrote: >> To creat a proper user agent string. >> >> On Wed, Apr 6, 2016 at 4:41 AM, Thomas Mortagne <[email protected]> >> wrote: >> >>> Why do you need to know the version to fix XWIKI-13284 ? Usually >>> xwiki-platform modules are supposed to be written for a specific >>> version of their dependencies. >>> >>> On Tue, Apr 5, 2016 at 11:19 PM, Sean Whalen <[email protected]> wrote: >>> > Hello, >>> > >>> > I'm very close to having code to contribute for XWIKI-13284 Add support >>> for >>> > loading RSS feeds over HTTPS in the RSS Macro >>> > >>> > https://jira.xwiki.org/browse/XWIKI-13284 >>> > >>> > I've looked over the code here >>> > >>> > >>> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running >>> > >>> > @Inject >>> > private CoreExtensionRepository coreExtensionRepository; >>> > ... >>> > CoreExtension distributionExtension = this.coreExtensionRepository. >>> > getEnvironmentExtension() >>> > Version version = distributionExtension.getId().getVersion() >>> > >>> > But I can't seem to import >>> > org.xwiki.extension.repository.CoreExtensionRepository from >>> > org.xwiki.rendering.internal.macro.rss. org.xwiki.extention will not >>> > resolve with org.xwiki.rendering.internal.macro.rss open in InteliJ. I'm >>> > new to Java web development. What am I missing? >>> > _______________________________________________ >>> > devs mailing list >>> > [email protected] >>> > http://lists.xwiki.org/mailman/listinfo/devs >>> >>> >>> >>> -- >>> Thomas Mortagne >>> _______________________________________________ >>> devs mailing list >>> [email protected] >>> http://lists.xwiki.org/mailman/listinfo/devs >>> >> _______________________________________________ >> devs mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/devs > > > > -- > Thomas Mortagne -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

