Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyBatisModule uses internal guice dependencies #9

Closed
h3adache opened this issue Aug 14, 2013 · 5 comments
Closed

MyBatisModule uses internal guice dependencies #9

h3adache opened this issue Aug 14, 2013 · 5 comments
Assignees
Milestone

Comments

@h3adache
Copy link
Member

The MyBatisModule uses static imports against internal guice dependencies.

import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkState;

It is expected that the guice team will use public guice apis so other versions of guice can be used with MyBatis-Guice.

java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions
       at org.mybatis.guice.MyBatisModule.internalConfigure(MyBatisModule.java:84)
       at org.mybatis.guice.AbstractMyBatisModule.configure(AbstractMyBatisModule.java:59)
       at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
       at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230)
       at com.google.inject.PrivateModule.install(PrivateModule.java:183)

[note] Migrated from https://code.google.com/p/mybatis/issues/detail?id=574

@alexey-su
Copy link
Contributor

Hello
I can not make their branches in github. I do not know how to add a file to a github comment.
Adding a new version changes mybatis-guice-osgi.diff for the project mybatis-guice version 3.5-SNAPSHOT.

I'm add diff file to topic https://groups.google.com/forum/#!topic/mybatis-user/aJM8YJVYFgY

@alexey-su
Copy link
Contributor

Thank you.
It is necessary to fix the assembly dependencies in the project. The file META-INF/MANIFEST.MF version 3.4.0 has a list of import packages
Need replacing two rows in pom.xml file

<osgi.import>com.jolbox.bonecp;resolution:=optional,com.mchange.v2.c3p0.;resolution:=optional,org.apache.commons.dbcp;resolution:=optional,
org.apache.commons.dbcp.cpdsadapter;resolution:=optional,org.apache.commons.dbcp.datasources;resolution:=optional,
&lt/osgi.import>

change to
<osgi.import>com.jolbox.bonecp.;resolution:=optional,com.mchange.v2.c3p0.;resolution:=optional,org.apache.commons.dbcp.;resolution:=optional,</osgi.import>

So we remove the hard dependency on third-party libraries.
Import-Package:
...
com.jolbox.bonecp;resolution:=optional,
com.jolbox.bonecp.hooks,
com.mchange.v2.c3p0;resolution:=optional,
change to
Import-Package:
...
com.jolbox.bonecp;resolution:=optional,
com.jolbox.bonecp.hooks;resolution:=optional,
com.mchange.v2.c3p0;resolution:=optional,

@christianpoitras
Copy link
Member

Thanks for the info. I totally missed it...

@Balderscape
Copy link

Hi, when is this fix likely to make its way to a release on maven cenral?

@christianpoitras
Copy link
Member

Hi! Since all developers work on MyBatis in their free time, it's impossible to for us to fix a date for a release. It's the downside of open source...
You can ask Simone since he is the main developer, but chances are that he will give you the same answer as me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants