I have come into some issues when trying to properly use UserCountServiceImpl
in my rest plugin for confluence.
I am not positive but I believe the correct import in maven is (unless it should be done as a plugin):
<dependency>
<groupId>com.atlassian.confluence.plugins</groupId>
<artifactId>confluence-license-rest</artifactId>
<version>${confluence.version}</version>
</dependency>
References in the .java file:
import com.atlassian.confluence.license.rest.service.UserCountServiceImpl;
(including this doesn’t cause an issue)
private final UserCountServiceImpl userCountServiceImpl = null;
(Including this DOES causes an issue)
I’ve tried to annotate it with @ComponentImport
, @Inject
and no annotation - every time I try to include it - I get something along the lines of this below when installing the plugin:
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle {$groupID} [264]: Unable to resolve 264.0: missing requirement [264.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.confluence.license.rest.service)
The plugin does builds fine - so I believe I have an issue in the POM file or the annotation that I am using. Or perhaps it’s a completely different issue.
As one last bit of info - I am working on a REST plugin, so I have used the Atlassian Confluence SDK Plugin creation (version 1, not 2) to get me started version.
Below is the rest resource that I am using that includes this class. I don’t have it doing anything just to determine the root cause.
@Path("/message")
public class MyRestResource {
@ComponentImport
private final UserManager userManager = null;
@ComponentImport
private final UserChecker userChecker = null;
@ComponentImport
private final LicenseService licenseService = null;
@ComponentImport
private UserCountServiceImpl userCountServiceImpl = null;
@GET
@AnonymousAllowed
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getMessage()
{
return Response.ok(new MyRestResourceModel("Hello World")).build();
}
}
Thanks for the help!
Adding this more defined error:
Unable to resolve 270.0: missing requirement [270.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.confluence.license.rest.service). This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
I am pretty fresh to plugin development, especially with Atlassian products - I am trying to look at the Felix Web Console now.