EDIT5 Aggiornato/errore exec-maven-plugin, anche nell'esempio di lavoro
Sto usando Maven 3.3.3.
Ho appena creato un nuovo progetto e aggiunto plugin di compilazione ed exec, come esempi sul web.
Ho provato ad eseguire, ma ho ottenuto l'errore
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project QNAProject: An exception occured while executing the Java class. com.jadex.qna.QNAProject.App -> [Help 1]<br>
[ERROR] <br>
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.<br>
[ERROR] Re-run Maven using the -X switch to enable full debug logging.<br>
[ERROR] <br>
[ERROR] For more information about the errors and possible solutions, please read the following articles:<br>
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException<br>
ho provato exec-maven-plugin versione 1.2.1 e 1.4.0, ma ho ottenuto lo stesso errore. Qui è il mio pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jadex.qna</groupId>
<artifactId>QNAProject</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>QNAProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>maven</executable>
<mainClass>com.jadex.qna.QNAProject.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Ho provato anche un progetto di esempio di lavoro da diversi siti,
quali
http://examples.javacodegeeks.com/enterprise-java/maven/create-java-project-with-maven-example/
http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/
ma ho ottenuto lo stesso errore.
Ho decompresso Maven in C: \ apache-maven-3.3.3 e ho creato la variabile di ambiente MAVEN_HOME come lo stesso percorso. Qual è il problema?
====================================
EDIT: Ecco il risultato
Beh .. ho impostato MAVEN_HOME, non M2_HOME perché tutorial di quello che ho trovato, ha detto di impostare solo ...
Naturalmente, echo% MAVEN_HOME% mostra
C: \ apache-maven-3.3.3
è sbagliato?
Ho aggiunto% MAVEN_HOME% \ bin alla variabile PATH, ma non ha funzionato.
E, sto usando eclissi
=====================================
EDIT2: qui è il registro completo. Ho usato l'obiettivo 'clean exec: java -e -X'
Era troppo lungo, quindi l'ho caricato sul mio blog qui.
E nota che ho cambiato cartella repository da C: \ Users .....m2 per nuova cartella di repository locale C: \ apache-maven-mercurial.localrepo.localrepository
======================= ================
Edit3: ho cambiato impostazione Maven-compiler-plugin come questo
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${env.JAVA_HOME}/bin/javac</executable>
<compilerVersion>1.5</compilerVersion>
<!-- <source>1.8</source>
<target>1.8</target> -->
</configuration>
</plugin>
E mi ha impedito di avere errore dal mvn -e compile exec:java
ma posso eseguire con mvn exec:java -Dexec.mainClass="com.jadex.qna.QNAProject.App"
=================================
edit4: OK, ci proverò dal basso, e posta di nuovo. Grazie per i tuoi sinceri aiuti.
======================================
EDIT5
i ha ripristinato tutte le sequenze ... re-installato Eclipse, Maven .. e progetti ricreati ... ma niente ha funzionato ...
ho cambiato le impostazioni di Eclipse per fissare il percorso JDK al percorso JDK installato, non JRE sentiero. poi ho scoperto che 'mvn -e clean compile exec: java' funziona, ma voglio solo 'mvn clean exec: java' lavoro. Non funziona affatto.
È possibile controllare sorgente completo qui
Questo è il messaggio della console corrente per 'mvn -e pulita exec: java'
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...ore artifacts.\n |\n | Default: ${user.home}/.m2/repository\n <l... @53:5) @ C:\apache-maven-3.3.3\conf\settings.xml, line 53, column 5
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...ore artifacts.\n |\n | Default: ${user.home}/.m2/repository\n <l... @53:5) @ C:\apache-maven-3.3.3\conf\settings.xml, line 53, column 5
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MavenTestProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ MavenTestProject ---
[INFO] Deleting C:\Users\bonavision_laptop\Desktop\Project\JadeX\MavenTestProject\MavenTestProject\target
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ MavenTestProject ---
[WARNING]
java.lang.ClassNotFoundException: com.jadex.qna.MavenTestProject.App
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.900 s
[INFO] Finished at: 2015-06-15T17:42:19+09:00
[INFO] Final Memory: 8M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project MavenTestProject: An exception occured while executing the Java class. com.jadex.qna.MavenTestProject.App -> [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/MojoExecutionException
Non riesco a riprodurre il tuo errore. Posso costruire usando il tuo POM. –
Qual è il contenuto della directory '.m2'? Questo dovrebbe trovarsi in qualche posto come 'C: \ Users \ RoxyEris \ .m2'. Assicurati che il plugin Codehaus sia stato scaricato. –
Sì, è C: \ Utente \ [MY DIR] \. M2, lo trovo anche da eclissi. (Progetto - Dipendenze Maven) E, prima di avere questo problema, avevo eseguito il progetto Jadex Maven per Android –