NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

NB Application build by maven and 'may be multiply loaded by modules'

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
Kutschera Peter
Posted via mailing list.





PostPosted: Fri Oct 30, 2009 3:06 pm    Post subject: NB Application build by maven and 'may be multiply loaded by modules' Reply with quote

Hello out there!

I just got an 'interesting' problem when running my maven-generated NB Application.

I found a lot of information about this problem and NOT maven-based applications on the internet, but not for maven-based projects.


My problem is as follows:

There are two mvn artifacts x-api and x-impl, where x-impl depends on x-api. Both of them are outside netbeans.

Now I have a NB RCP Application with two modules:
xfilesupport (depending on x-impl)
xfileviewer (depending on x-impl)

When starting the application I get a lot of warnings for x-impl, x-api and all artefacts x-impl and x-api are depending on.

WARNUNG [org.netbeans.core.startup.NbEvents]: The extension ..x-api-1.0-SNAPSHOT.jar may be multiply loaded by modules: [...-xfilesupport.jar, ...-xfileviewer.jar]; see: http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#class-path

It seems to me this link is non-maven specific, I am not sure if and how I can use this in information.

The interesting thing is that both, xfilesupport and xfileviewer depends on e.g. org-openide-util but there are no warnings about the org-openide-util artefact.

I tried the following:
Since xfileviewer depends on xfilesupport I removed the direct dependency to x-impl in pom.xml.
There is NO dependency to x-api in the pom.xml!
This results in
Adding on module's Class-Path:
..x-api:jar:1.0-SNAPSHOT
.. some artefacts x-api depends on ..
Private classes referenced from module: [...x_impl.SomeClassImpl]
[ERROR]Project depends on packages not accessible at runtime in module ...xfilesupport:jar:1.0-SNAPSHOT

So what can I do?
* Should I add the x-impl and x-api packages as public packages to xfilesupport?
* I already tried to move all dependencies to external artifacts in one nbm "extArtifacts" and depending on this in my other nbms, but this did not help, but maybe IU did something wrong, I am sot sure about this.
* And I don't want to put all of my code within 1 (one) nbm, but this seems to be the next thing to try on monday morning :-(


Any help will be welcome.

Thanks in advance and have a nice weekend
Peter Kutschera
Back to top
mkleint
Posted via mailing list.





PostPosted: Mon Nov 02, 2009 6:59 am    Post subject: NB Application build by maven and 'may be multiply loaded by modules' Reply with quote

Kutschera Peter wrote:
Quote:
Hello out there!

I just got an 'interesting' problem when running my maven-generated NB Application.

I found a lot of information about this problem and NOT maven-based applications on the internet, but not for maven-based projects.


My problem is as follows:

There are two mvn artifacts x-api and x-impl, where x-impl depends on x-api. Both of them are outside netbeans.

Now I have a NB RCP Application with two modules:
xfilesupport (depending on x-impl)
xfileviewer (depending on x-impl)

When starting the application I get a lot of warnings for x-impl, x-api and all artefacts x-impl and x-api are depending on.

WARNUNG [org.netbeans.core.startup.NbEvents]: The extension ..x-api-1.0-SNAPSHOT.jar may be multiply loaded by modules: [...-xfilesupport.jar, ...-xfileviewer.jar]; see: http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#class-path

It seems to me this link is non-maven specific, I am not sure if and how I can use this in information.

The interesting thing is that both, xfilesupport and xfileviewer depends on e.g. org-openide-util but there are no warnings about the org-openide-util artefact.

I tried the following:
Since xfileviewer depends on xfilesupport I removed the direct dependency to x-impl in pom.xml.
There is NO dependency to x-api in the pom.xml!
This results in
Adding on module's Class-Path:
..x-api:jar:1.0-SNAPSHOT
.. some artefacts x-api depends on ..
Private classes referenced from module: [...x_impl.SomeClassImpl]
[ERROR]Project depends on packages not accessible at runtime in module ...xfilesupport:jar:1.0-SNAPSHOT

That's the core of the problem. If you depend on a module, that module
need to expose public packages. Even for external classpath items it
ships with.
So either xfilesupport needs to expose the packages from the x-impl, or
have a separate module for the x-impl binary that will expose the api
packages. In either case the api packages config is done as part of the
nbm-maven-plugin configuration.
please check the Maven Dependency vs NetBeans runtime dependency section
in http://mojo.codehaus.org/nbm-maven-plugin/

Milos


Quote:
So what can I do?
* Should I add the x-impl and x-api packages as public packages to xfilesupport?
* I already tried to move all dependencies to external artifacts in one nbm "extArtifacts" and depending on this in my other nbms, but this did not help, but maybe IU did something wrong, I am sot sure about this.
* And I don't want to put all of my code within 1 (one) nbm, but this seems to be the next thing to try on monday morning :-(


Any help will be welcome.

Thanks in advance and have a nice weekend
Peter Kutschera


Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo