Commits

shemnon  committed d96b22b

Convention change. If there is a single "Main.java" file... anywhere then it is preconfigured to be the mainClass, otherwise the mainClass is empty.

  • Participants
  • Parent commits 28a225b

Comments (0)

Files changed (2)

File gradle-javafx-plugin/src/main/groovy/org/bitbucket/shemnon/javafxplugin/JavaFXPlugin.groovy

         project.javafx {
             jfxrtJar = jfxrtJarFile
             antJavaFXJar = project.files(findAntJavaFXJar())
-            mainClass = "${project.group}${(project.group&&project.name)?'.':''}${project.name}${(project.group||project.name)?'.':''}Main"
             appName = project.name //FIXME capatalize
             packaging = 'all'
             signingMode = 'release'
         configureScenicViewTask(project)
         configureRunTask(project)
         configureDebugTask(project)
+
+        def mains = []
+        project.convention.getPlugin(JavaPluginConvention).sourceSets[SourceSet.MAIN_SOURCE_SET_NAME].allJava.visit {
+            if (it.relativePath.lastName == 'Main.java') {
+                mains.add(it.relativePath.replaceLastName('Main').pathString.replace('/', '.'))
+            }
+        }
+
+        if (mains.size() == 1) {
+            project.javafx.mainClass = mains[0]
+        }
+
     }
 
 

File samples/FXML-LoginDemo/build.gradle

 apply from: 'https://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot/javafx.plugin'
-
-javafx {
-    mainClass = 'demo.Main'
-}