Skip to main content

Failed to build javax.mail.jar

  9 posts   Feedicon  
Replies: 8 - Last Post: March 02, 2013 01:07
by: dres
showing 1 - 9 of 9
Posted: January 04, 2013 05:04 by sharmaneelam

I am building javax.mail.jar using with the source of "JavaMail 1.4.4 source code", downloaded from , we have some customized changes in few source java files (regarding IMAP and response) of this source, otherwise no changes we have done in this source for building mail jar with maven.

I was using Maven 2.2.1 - successfully downloaded repository on my systems when I had Java 1.6. Then I have moved to java 7 but it failed, on roll back changes I was unable to download repositories as I had downloaded at earlier stage.

System has set JAVA_HOME of Java Home directory

[INFO] ----------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
[INFO] ----------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionExcep tion: Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeGoals(
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeGoalWithLifecycle(DefaultLifecycleExecuto
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeGoal(
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeGoalAndHandleFailures(DefaultLifecycleExe
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeTaskSegments(DefaultLifecycleExecutor.jav a:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.execute(
at org.apache.maven.DefaultMaven.doExecute(DefaultMav
at org.apache.maven.DefaultMaven.execute(DefaultMaven .java:138)
at org.apache.maven.cli.MavenCli.main( 62)
at org.apache.maven.cli.compat.CompatibleMain.main(Co
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
at java.lang.reflect.Method.invoke(
at org.codehaus.classworlds.Launcher.launchEnhanced(L
at org.codehaus.classworlds.Launcher.launch(Launcher. java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode (
at org.codehaus.classworlds.Launcher.main(Launcher.ja va:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.plugin.DefaultPluginManager.getCo nfiguredMojo(
at org.apache.maven.plugin.DefaultPluginManager.execu teMojo(
at org.apache.maven.lifecycle.DefaultLifecycleExecuto r.executeGoals(
... 17 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.jav a:2291)
at java.lang.Class.getDeclaredField(
at tFieldByNameIncludingSuperclasses(ReflectionUtils. java:47)
at org.codehaus.plexus.component.composition.FieldCom ponentComposer.getFieldByName(FieldComponentCompos
at org.codehaus.plexus.component.composition.FieldCom ponentComposer.findMatchingField(FieldComponentCom
at org.codehaus.plexus.component.composition.FieldCom ponentComposer.assembleComponent(FieldComponentCom
at org.codehaus.plexus.component.composition.DefaultC omponentComposerManager.assembleComponent(DefaultC
at org.codehaus.plexus.DefaultPlexusContainer.compose Component(
at org.codehaus.plexus.personality.plexus.lifecycle.p hase.CompositionPhase.execute(CompositionPhase.jav a:29)
at org.codehaus.plexus.lifecycle.AbstractLifecycleHan dler.start(
at org.codehaus.plexus.component.manager.AbstractComp onentManager.startComponentLifecycle(AbstractCompo
at org.codehaus.plexus.component.manager.AbstractComp onentManager.createComponentInstance(AbstractCompo
at org.codehaus.plexus.component.manager.PerLookupCom ponentManager.getComponent(PerLookupComponentManag
at org.codehaus.plexus.DefaultPlexusContainer.lookup(
at org.codehaus.plexus.DefaultPlexusContainer.lookup(
at org.apache.maven.plugin.DefaultPluginManager.getCo nfiguredMojo(
... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.osgi.Maven2OsgiConverter
at$ 200)
at Method)
at ava:188)
at java.lang.ClassLoader.loadClass( 07)
at org.codehaus.classworlds.RealmClassLoader.loadClas sDirect(
at org.codehaus.classworlds.DefaultClassRealm.loadCla ss(
at org.codehaus.classworlds.DefaultClassRealm.loadCla ss(
at org.codehaus.classworlds.RealmClassLoader.loadClas s(
at java.lang.ClassLoader.loadClass( 52)
at java.lang.ClassLoader.loadClassInternal(ClassLoade
... 36 more
[INFO] ----------------------------------------------------------------------
[INFO] Total time: 29 minutes 36 seconds
[INFO] Finished at: Fri Dec 21 13:07:49 IST 2012
[INFO] Final Memory: 13M/23M
[INFO] ----------------------------------------------------------------------

Complete log output of downloading process can be seen here -

I am removing local repository ".m2" folder from my user each time before restart build. I have tried to download on different OS but it always stuck at same error.

Can anybody please let me know what settings are changed that I need to update ? Or which repositories need to remove to get rid of this error?
Posted: January 24, 2013 18:46 by Bill Shannon
As someone said in your OTN forum posting of the same problem, this looks more like a maven problem than anything related to JavaMail. Removing the .m2 local repository is a good start, but you might want to check your maven software installation as well to make sure nothing is missing or corrupted there. I believe you should be able to build with only the maven central repository so check your remote repository setup as well.
Posted: February 27, 2013 19:32 by dres
Which version of maven should be used? Maven 3 has been out for a long time and is default on OS X but some projects don't work with it yet. I get all types of build errors, mostly test failures and the osgi packaging.
Posted: February 28, 2013 05:50 by Bill Shannon
The latest source builds with Maven 3.

If you're still building the 1.4.4 source, it requires Maven 2.
Posted: February 28, 2013 17:06 by dres
I'm building off of the 1.4.6 tag plus the change to fix the bug I reported. I compiled skipping tests but SSLSocket wasn't resolved and I ended up with a broken jar. Are there any instructions anywhere for building from source?
Posted: March 01, 2013 05:10 by Bill Shannon
Build instructions are on the wiki.
SSLSocket is part of the JDK. What version of the JDK are you using?
Posted: March 01, 2013 17:27 by dres
Yeah I know. I don't know why I got a bad build. I have a working jar now but I still have tons of test failures. I have to run with -Dmaven.test.skip=true to build.

I haven't looked into the test failures, so I will stop complaining. Maybe when I want to enhance the gimap or other features, I'll figure it out. Thanks for your help.
Posted: March 01, 2013 21:13 by Bill Shannon
Most of the tests are pretty simple and should just work.

Some of the tests rely on "dummy" mail servers, which means they start a thread
that listens on a particular port. The port numbers are hard wired. It would probably
be better if a free port were determined dynamically. If the ports are in use on your
machine, that would cause the tests to fail.

What operating system are you running the tests on?
Posted: March 02, 2013 01:07 by dres
OS X. thanks for the tip
showing 1 - 9 of 9
Replies: 8 - Last Post: March 02, 2013 01:07
by: dres
Please Confirm