messapix / jfxmobile-maven-plugin

Maven version of jfxmobile plugin
Apache License 2.0
5 stars 3 forks source link

build failure #1

Closed aminabs closed 8 years ago

aminabs commented 8 years ago

Hi there, I'm trying to compile a simple fx application for android. Up to now, I've found two different plugins and want to know what the difference is. The first one is the jfxmobile-maven-plugin (from this website) and the second one is jfxmobile-plugin as follows:

<plugin>
                <groupId>org.javafxports</groupId>
               <artifactId>jfxmobile-plugin</artifactId>
                <version>1.0.7</version>
....
</plugin>

Another question I have is about the usage of the two plugins. I've followed the example for the jfxmobile-maven-plugin and created a pom exactly as mentioned there. However, I've faced the following error while executing 'mvn package':

Error injecting: com.messapix.ftatr.jfxmobile.maven.plugin.android.lifecycle.ApkMojo
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.execution.MavenSession was bound.
  at ClassRealm[plugin>com.messapix.ftatr.jfxmobile:jfxmobile-maven-plugin:1.0.0-b2, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.MobileExpressionEvaluator
  at ClassRealm[plugin>com.messapix.ftatr.jfxmobile:jfxmobile-maven-plugin:1.0.0-b2, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.MobileConf
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.android.lifecycle.ApkMojo

1 error
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1006)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:459)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

and here is the pom's:

...
<packaging>jar</packaging>
...
<plugin>
                <groupId>com.messapix.ftatr.jfxmobile</groupId>
                <artifactId>jfxmobile-maven-plugin</artifactId>
                <version>1.0.0-b2</version>
                <extensions>true</extensions>
                <configuration>
                    <mainClass>com.rayanova.test.Main</mainClass>
                    <android>
                        <manifest>src/android/AndroidManifest.xml</manifest>
                        <dependencies>
                            <dependency>
                                <groupId>com.gluonhq</groupId>
                                <artifactId>charm-down-android</artifactId>
                                <version>1.0.0</version>
                                <scope>runtime</scope>
                            </dependency>
                        </dependencies>
                    </android>
                    <desktop>
                    </desktop>
                </configuration>
                <executions>
                    <execution>
                        <id>someid</id>
                        <phase>package</phase>
                        <goals>
                            <goal>android-apk</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
agloria commented 8 years ago

If you want to use maven the correct plugin is: <plugin> <groupId>com.messapix.ftatr.jfxmobile</groupId> <artifactId>jfxmobile-maven-plugin</artifactId> <version>1.0.0-b2</version> ... </plugin>

Remove <execution> element from the plugin configuration.

If you want to build for android simply type: mvn clean package android

aminabs commented 8 years ago

Thanks for your reply, If you look at my previous comment, I did mention the details about both the plugin I've used and the error message I've got. Please take a second look at the latest part of my previous comment (after the exception messages). The way of reporting the issue is probably confusing; sorry for that.

I used the above plugin as you stated, the same version, with&without putting the tag inside the pom file. In both cases, the same error message appears as I mentioned above. Here is the simplest form of using the plugin which produces the ProvisionExcepion with message: No implementation for org.apache.maven.execution.MavenSession was bound.

           <plugin>
                <groupId>com.messapix.ftatr.jfxmobile</groupId>
                <artifactId>jfxmobile-maven-plugin</artifactId>
                <version>1.0.0-b2</version>
                <extensions>true</extensions>
                <configuration>
                    <mainClass>com.rayanova.test.Main</mainClass>
                    <android>
                        <manifest>src/android/AndroidManifest.xml</manifest>
                    </android>
                    <desktop>
                    </desktop>
                </configuration>
            </plugin>

I would say the exception raises because of a required dependency which I've forgotten to put inside the pom or something like this. It seems the plugin requires an implementation for org.apache.maven.execution.MavenSession to be injected somewhere inside the plugin.

Can you give me a sample maven project which demonstrates the usage of the plugin? I need to know if there are some dependencies/settings which I should add/set to the pom/project.

agloria commented 8 years ago

You can use the archetype: com.messapix.ftatr.jfxmobile:jfxmobile-archetype:1.0.0-b1

this archetype creates a new jfxmobile project that uses 1.0.0-b1 version of the plugin. Change plugin version to 1.0.0-b2 and run mvn clean package android

agloria commented 8 years ago

Which version of maven are you using?

aminabs commented 8 years ago

Hi, I gave the archetype a try exactly as you guided, and unfortunately the same exception occurs.

i.e., mvn clean package android results in:

[INFO] --- jfxmobile-maven-plugin:1.0.0-b2:android-configure (default-android-configure) @ mavenarchetypeJfxmobile ---
[WARNING] Error injecting: com.messapix.ftatr.jfxmobile.maven.plugin.android.lifecycle.ConfigureMojo
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.execution.MavenSession was bound.
  at ClassRealm[plugin>com.messapix.ftatr.jfxmobile:jfxmobile-maven-plugin:1.0.0-b2, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.MobileExpressionEvaluator
  at ClassRealm[plugin>com.messapix.ftatr.jfxmobile:jfxmobile-maven-plugin:1.0.0-b2, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.MobileConf
  while locating com.messapix.ftatr.jfxmobile.maven.plugin.android.lifecycle.ConfigureMojo
  ... 

To answer you second question: I am using maven version 3.1.1 (netbeans 8.0.2); the maven-compiler-plugin was however, pretty old: 2.3.1. Hence, I did update the maven-compiler-plugin as follows, but the problem still remains the same as above:

<plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.3</version>
      <configuration>
       <source>1.8</source>
       <target>1.8</target>
        </configuration>
 </plugin>
aminabs commented 8 years ago

Problem solved! It seems something is wrong with the plugin while running on top of maven version 3.1.1. I simply downloaded and installed the latest maven release (version 3.3.9) and now it's working like a charm.

Thanks.