Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Spring MANIFEST generation inconsistency

Igor Loskutov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2012

Hi. Just tried to publish some packages from my plugin to others.

Problem is : in my plugin I use Active Objects import. It configured in atlassian-plugin.xml.

<component-import key="ao-import" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
        <description>Component to access Active Objects functionality from the plugin</description>
    </component-import>

It works fine and so on. BUT. When I trying publish packages in pom.xml like that :

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-jira-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <productVersion>${jira.version}</productVersion>
        <productDataVersion>${jira.version}</productDataVersion>
        <instructions>
            <Export-Package>
                my.little.pony.plugin.event*;version="${project.version}"
            </Export-Package>
        </instructions>
    </configuration>
</plugin>

I receive this message in console on runtime :

"Unable to enabel plugin ... *blah blah* ... Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle my.little.pony.plugin [92]: Unable to resolve 92.0: missing requirement [92.0] package; (&(package=com.atlassian.activeobjects.external)(version>=1.0.0))

So ok, it's imported with wrong version now, exactly, checking generated MANIFEST.MF in .osgi-plugins i found

Import-Package: ... blah blah ... com.atlassian.activeobjects.external;resolution:="mandatory";version="1.0"

instead of

Import-Package: ... blah blah ... com.atlassian.activeobjects.external

in first (working fine) case.

So why it changed activeobjects version when i did some unrelated stuff and how to fix this issue?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Charles Duffy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2012

Put the Import-Package into your instructions explicitly:

<instructions>
<Import-Package>com.atlassian.activeobjects.external,*;resolution:=optional</Import-Package>
<Export-Package>my.little.pony.plugin.event*;version="${project.version}"</Export-Package>
</instructions>

Igor Loskutov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2012

This just don't work as I want - in this case <Import-Package> instructions override all explicit and emplicit imports, imports in atlassian-plugin.xml too.

Charles Duffy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2012

@IgorLoskutoff Updated answer to add the optional wildcard entry, restoring implicit imports.

Igor Loskutov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2012

Charles, thanks for your answers. But it didn't work too.
I just keep receive

Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle ru.myplugin.blahblah [92]: Unable to resolve 92.0: missing requirement [92.0] package; (&amp;(package=com.atlassian.activeobjects.external)(version&gt;=1.0.0))

Of course I resolved it by making necessary classes public components in atlassian-plugin.xml but this decision doesn't satisfy me, its ugly and not error-prone. Hovewer works.

I wonder how to resolve problem and use atlassian-plugin.xml imports and pom.xml imports together, any suggestions are welcome.

Charles Duffy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2012

No 1.0 version exists yet -- depending on which Atlassian project you're using, you might need to specify a minimum version more like 0.19.7 (which JIRA 5.0.x uses).

TAGS
AUG Leaders

Atlassian Community Events