Estou seguindo o passo a passo do livro, porem não estou conseguindo criar o executavel do programa desenvolvido em JavaFX com Maven. No livro pede se para adicionar um plugin e executar o comando jfx:jar, porem a tarefa não é completa pq aparece o seguinte erro
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.119 s
[INFO] Finished at: 2016-03-18T16:04:23-03:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.1.2:jar (default-cli) on project livraria-fx-ebook: Execution default-cli of goal com.zenjava:javafx-maven-plugin:8.1.2:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.1.2 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path C:\Program Files (x86)\Java\jre1.8.0_66/…/lib/ant-javafx.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Então gostaria de saber como que faz para criar um executavel do projeto. abaixo esta o pom.xml do meu sistema
Se não funcionar, pode me passar mais detalhes sobre o seu ambiente?
Exemplo: versão do maven, versão do Java, sistema operacional e o que mais achar relevante.
Boa tarde, estou com o mesmo problema no código. Fiz a atualização que sugeriu e manteve o erro. A versão do java é 8 e o sistema operacional é windows.
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building livraria-fx 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> javafx-maven-plugin:8.4.0:jar (default-cli) > [jfxjar]package @ livraria-fx >>>
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ livraria-fx —
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ livraria-fx —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ livraria-fx —
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Elis Fernanda\workspace\livraria-fx\src\test\resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ livraria-fx —
[INFO] No sources to compile
[INFO]
[INFO] — maven-surefire-plugin:2.12.4:test (default-test) @ livraria-fx —
[INFO]
[INFO] — maven-jar-plugin:2.4:jar (default-jar) @ livraria-fx —
[INFO] Building jar: C:\Users\Elis Fernanda\workspace\livraria-fx\target\livraria-fx-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] <<< javafx-maven-plugin:8.4.0:jar (default-cli) < [jfxjar]package @ livraria-fx <<<
[INFO]
[INFO] — javafx-maven-plugin:8.4.0:jar (default-cli) @ livraria-fx —
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.687 s
[INFO] Finished at: 2016-07-10T18:18:36-03:00
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.4.0:jar (default-cli) on project livraria-fx: Execution default-cli of goal com.zenjava:javafx-maven-plugin:8.4.0:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.4.0 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path C:\Program Files (x86)\Java\jre1.8.0_91/…/lib/ant-javafx.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Estou tendo o mesmo problema ja tentei atualizar baixei novos plugins no site da eclipse e o erro perciste:
xception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at LoginAPP.initComponents(LoginAPP.java:57)
at LoginAPP.start(LoginAPP.java:24)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
… 1 more
Exception running application LoginAPP
AnchorPane pane = new AnchorPane();
pane.setPrefSize(400, 300);
pane.setStyle("-fx-background-color: linear-gradient(from 0% 0% to 100% 100%, blue 0%, black 100%);");
TextField txLogin = new TextField();
txLogin.setPromptText("Digite aqui seu login");
PasswordField txSenha = new PasswordField();
txSenha.setPromptText("Digite aqui sua senha");
Button btEntrar = new Button("Entrar");
Button btSair = new Button("Sair");
pane.getChildren().addAll(txLogin, txSenha, btEntrar, btSair);
Scene scene = new Scene(pane);
stage.setScene(scene);
stage.show();
}
private void initLayout() {
txLogin.setLayoutX((pane.getWidth() - txLogin.getWidth())/ 2);
txLogin.setLayoutY(50);
txSenha.setLayoutX((pane.getWidth() - txSenha.getWidth())/ 2);
txSenha.setLayoutY(100);
btEntrar.setLayoutX((pane.getWidth() - btEntrar.getWidth())/ 2);
btEntrar.setLayoutY(150);
btSair.setLayoutX((pane.getWidth() - btSair.getWidth())/ 2);
btSair.setLayoutY(200);
}
public static Stage getStage() {
return stage;
}
public static void main(String[] args) {
launch(args);
}
private void initListeners() {
btSair.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
fecharAplicacao();
}
});
btEntrar.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
logar();
}
});
}
private void logar(){
if (txLogin.getText().equals("admin") &&
txSenha.getText().equals("casadocodigo")) {
// TODO Abrir a tela VitrineApp
} else {
JOptionPane.showMessageDialog(null, "Login e/ou senha inválidos", "Erro", JOptionPane.ERROR_MESSAGE);
}
}
private void fecharAplicacao(){
System.exit(0);
}
No meu arquivo pom.xml duas linhas aparecem em amarelo pelo Eclipse, são exatamente as do artifactId maven-compiler-plugin e artifactId javafx-maven-plugin
Tradução da mensagem do Eclipse: Plugin não pôde ser resolvido. Verifique se o groupId, o artifactId e a versão do plug-in estão presentes. Informações adicionais: Não é possível resolver maven-compiler-plugin