Compile maven netbeans project in terminal - java

I would like compile a Netbeans Maven - Java Application in my linux terminal.
This is because I would like to work with Git CVS and be able to compile the project in a server being IDE independent.
But I'm having trouble understanding really how dependencies work, or that's what I think.
I'm using a simple java application code to connect to a mysql database and get some information.
I'm using this code:
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
try (Connection connect = DriverManager.getConnection("jdbc:mysql://192.168.2.21/altadb?" + "user=marco&password=Marco19")) {
Statement statement = connect.createStatement();
ResultSet resultSet = statement.executeQuery("select idCuentaConcentradora, noCliente, nombreCliente, noCuenta, nombreCuenta from altadb.catCuentaConcentradora");
while (resultSet.next()) {
int idCuentaConcentradora = resultSet.getInt("idCuentaConcentradora");
String noCliente = resultSet.getString("noCliente");
String nombreCliente = resultSet.getString("nombreCliente");
String noCuenta = resultSet.getString("noCuenta");
String nombreCuenta = resultSet.getString("nombreCuenta");
System.out.println("idCuentaConcentradora: " + idCuentaConcentradora);
System.out.println("noCliente: " + noCliente);
System.out.println("nombreCliente: " + nombreCliente);
System.out.println("noCuenta: " + noCuenta);
System.out.println("nombreCuenta: " + nombreCuenta);
System.out.println("---------------------------------------------------");
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
Then added the mysql-connector-java to the project dependencies, the pom.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?><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.alta.MySQLAccess_Mvn</groupId>
<artifactId>MySQLAccess_Mvn</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.31</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
If I use the netbeans IDE with clean and build and then run the project there is no error and the information is fetched from the database.
If I try to do the same from terminal I get an error:
[marko#mark-laptop MySQLAccess_Mvn]$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MySQLAccess_Mvn 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # MySQLAccess_Mvn ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # MySQLAccess_Mvn ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # MySQLAccess_Mvn ---
[INFO] Compiling 1 source file to /home/marko/NetBeansProjects/MySQLAccess_Mvn/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # MySQLAccess_Mvn ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/marko/NetBeansProjects/MySQLAccess_Mvn/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # MySQLAccess_Mvn ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # MySQLAccess_Mvn ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # MySQLAccess_Mvn ---
[INFO] Building jar: /home/marko/NetBeansProjects/MySQLAccess_Mvn/target/MySQLAccess_Mvn-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # MySQLAccess_Mvn ---
[INFO] Installing /home/marko/NetBeansProjects/MySQLAccess_Mvn/target/MySQLAccess_Mvn-1.0-SNAPSHOT.jar to /home/marko/.m2/repository/com/alta/MySQLAccess_Mvn/MySQLAccess_Mvn/1.0-SNAPSHOT/MySQLAccess_Mvn-1.0-SNAPSHOT.jar
[INFO] Installing /home/marko/NetBeansProjects/MySQLAccess_Mvn/pom.xml to /home/marko/.m2/repository/com/alta/MySQLAccess_Mvn/MySQLAccess_Mvn/1.0-SNAPSHOT/MySQLAccess_Mvn-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.866 s
[INFO] Finished at: 2014-06-18T18:46:28-06:00
[INFO] Final Memory: 12M/144M
[INFO] ------------------------------------------------------------------------
[marko#mark-laptop MySQLAccess_Mvn]$ java -cp target/MySQLAccess_Mvn-1.0-SNAPSHOT.jar com.marco.mysql.first.test.test
Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.marco.mysql.first.test.test.main(test.java:23)
Thought since the dependency is being declared in the pom.xml the mysql driver would have been added to the project libraries... but it doesn't.
I would like to achieve the same output from Netbeans from terminal, from build to run.
I don't know how to do it.

If you have maven added to the system path then you can simply compile it using the maven commands on the prompt:
mvm clean install

Related

I met two unsolvable problems about jenkins

Firstly this are my configures
enter image description here
It seems that I can't upload the picture, so I copied the error message
my jdk version is jdk1.8.0_152
my maven version is apache-maven-3.6.1-bin
I can run this program in IDEA
public class Main {
public static void main(String[] args) throws IOException {
String filePath = "./cifile";
File dir = new File(filePath);
// 一、检查放置文件的文件夹路径是否存在,不存在则创建
if (!dir.exists()) {
dir.mkdirs();// mkdirs创建多级目录
}
File checkFile = new File(filePath + "/filename.txt");
FileWriter writer = null;
try {
// 二、检查目标文件是否存在,不存在则创建
if (!checkFile.exists()) {
checkFile.createNewFile();// 创建目标文件
}
// 三、向目标文件中写入内容
// FileWriter(File file, boolean append),append为true时为追加模式,false或缺省则为覆盖模式
writer = new FileWriter(checkFile, true);
writer.append("my content");
writer.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != writer)
writer.close();
}
}
}
This program is just a simple write file
So there is no configuration in my pom.xml file
<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
<artifactId>citest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
</project>
The following is my error message
Started by user ameng
Running as SYSTEM
Building in workspace C:\Users\阿蒙\.jenkins\workspace\test
Updating http://114.67.219.61:8080/svn/TeamDesigner at revision '2022-10-21T14:20:55.278 +0800' --quiet
Using sole credentials pengweihao/****** in realm ‘<http://114.67.219.61:8080> VisualSVN Server’
At revision 3
No changes for http://114.67.219.61:8080/svn/TeamDesigner since the previous build
Parsing POMs
Established TCP socket on 64312
[TeamDesigner] $ "C:\Program Files\Java\jdk1.8.0_152/bin/java" -cp C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.14.jar;D:\apache-maven-3.6.1-bin\boot\plexus-classworlds-2.6.0.jar;D:\apache-maven-3.6.1-bin/conf/logging jenkins.maven3.agent.Maven35Main D:\apache-maven-3.6.1-bin C:\Users\??\.jenkins\war\WEB-INF\lib\remoting-4.13.2.jar C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.14.jar C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.14.jar 64312
Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:136)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:66)
ERROR: ================================================================================
ERROR: Invalid project setup: Connection reset
ERROR: [JENKINS-18403][JENKINS-28294] JDK 'jdk' not supported to run Maven projects.
ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the controller.
ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
ERROR: Retrying with agent Java and setting compile/test properties to point to C:\Program Files\Java\jdk1.8.0_152.
ERROR: ================================================================================
Established TCP socket on 64314
[TeamDesigner] $ "C:\Program Files\Java\jre1.8.0_152/bin/java" -cp C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.14.jar;D:\apache-maven-3.6.1-bin\boot\plexus-classworlds-2.6.0.jar;D:\apache-maven-3.6.1-bin/conf/logging jenkins.maven3.agent.Maven35Main D:\apache-maven-3.6.1-bin C:\Users\??\.jenkins\war\WEB-INF\lib\remoting-4.13.2.jar C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.14.jar C:\Users\阿蒙\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.14.jar 64314
Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:136)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:66)
[TeamDesigner] $ cmd.exe /C "D:\apache-maven-3.6.1-bin\bin\mvn.cmd clean package && exit %%ERRORLEVEL%%"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< org.example:citest >-------------------------
[INFO] Building citest 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # citest ---
[INFO] Deleting C:\Users\阿蒙\.jenkins\workspace\test\TeamDesigner\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # citest ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # citest ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\阿蒙\.jenkins\workspace\test\TeamDesigner\target\classes
[WARNING] /C:/Users/阿蒙/.jenkins/workspace/test/TeamDesigner/src/main/java/org/example/Main.java:[15,13] 编码GBK的不可映射字符
[WARNING] /C:/Users/阿蒙/.jenkins/workspace/test/TeamDesigner/src/main/java/org/example/Main.java:[22,18] 编码GBK的不可映射字符
[WARNING] /C:/Users/阿蒙/.jenkins/workspace/test/TeamDesigner/src/main/java/org/example/Main.java:[26,18] 编码GBK的不可映射字符
[WARNING] /C:/Users/阿蒙/.jenkins/workspace/test/TeamDesigner/src/main/java/org/example/Main.java:[26,34] 编码GBK的不可映射字符
[WARNING] /C:/Users/阿蒙/.jenkins/workspace/test/TeamDesigner/src/main/java/org/example/Main.java:[27,93] 编码GBK的不可映射字符
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # citest ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\阿蒙\.jenkins\workspace\test\TeamDesigner\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # citest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # citest ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # citest ---
[INFO] Building jar: C:\Users\阿蒙\.jenkins\workspace\test\TeamDesigner\target\citest-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.156 s
[INFO] Finished at: 2022-10-21T14:20:59+08:00
[INFO] ------------------------------------------------------------------------
ERROR: Failed to parse POMs
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:457)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404)
at hudson.slaves.Channels.forProcess(Channels.java:119)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:296)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
at hudson.model.Run.execute(Run.java:1897)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE
I can't understand why my jdk can't support running maven
Secondly, it is clear that the compilation has been successful and the jar package has also been generated, but why does the final result still fail
By the way, I pull files from TortoiseSVN
Related links do not solve my problem because I only have one machine working, no msater and slave

How to debug springboot maven application in intellij

I want to start spring-boot maven application in debug mode in intellij Idea, but when I make breakpoints the application doesn't suspend and goes further. I've read a lot of topics but I still don't understand how to do it. Could you help me decide the best course of action.
Edit: I use spring-boot-maven-plugin and Maven Run/Debug configuration with spring-boot:run in command line.
Edit: So when I added Jvm Arguments to pom.xml I recieved such log:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building shop 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) > test-compile # shop >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Валера\IdeaProjects\shop\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) < test-compile # shop <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) # shop ---
[INFO] Attaching agents: []
Listening for transport dt_socket at address: 5005
But when requesting localhost:5005/myPage I recieve Error 101 (net: : ERR_CONNECTION_RESET). Seems like some maven arguments did not specify.
Here my maven plagin in pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug - Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
In your Run/Debug Configurations enter the following into your command line:
spring-boot:run -Dspring.profiles.active=local,<mine> -Dfork=false -f pom.xml
My Maven spring-boot:run configuration debugs just fine with the -D fork=false added.
You may use below command in the CLI:
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n
Below is my project settings:
enter image description here

mvn tomcat7:deploy - Cannot invoke Tomcat manager: Broken pipe

I'm getting an error trying to deploy the CLIFF .war to my tomcat7 server.
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Connection to http://localhost:8080 refused: Connection refused
OS X 10.10.5
Apache Tomcat/8.0.24
JVM 1.8.0_05-b13
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)
Maven home: /Users/davidlaxer/Downloads/apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
David-Laxers-MacBook-Pro:CLIFF davidlaxer$
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ sudo mvn tomcat7:deploy -DskipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] CLIFF
[INFO] common
[INFO] stanford-entity-extractor
[INFO] cliff
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CLIFF 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF >>>
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building common 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # common >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # common ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # common ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # common ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # common ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # common <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # common ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stanford-entity-extractor 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 23 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # stanford-entity-extractor ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # stanford-entity-extractor ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cliff 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # cliff ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/webapp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # cliff ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # cliff ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # cliff ---
[INFO] Packaging webapp
[INFO] Assembling webapp [cliff] in [/Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/davidlaxer/CLIFF/webapp/src/main/webapp]
[INFO] Webapp assembled in [1345 msecs]
[INFO] Building war: /Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff ---
[INFO] Deploying war to http://localhost:8080/cliff-2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 1.728 s]
[INFO] common ............................................ SUCCESS [ 1.883 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [ 0.265 s]
[INFO] cliff ............................................. FAILURE [ 11.384 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.717 s
[INFO] Finished at: 2015-08-26T08:07:32-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Connection to http://localhost:8080 refused: Connection refused -> [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/ConnectException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cliff
pom.xml:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<server>CliffTomcatServer</server>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
~/.m2/settings.xml:
<server>
<id>CliffTomcatServer</id>
<username>cliff</username>
<password>beer</password>
</server>
/usr/local/apache-tomcat-8.0.24/conftomcat_users.xml:
<tomcat-users>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="cliff" password="beer" roles="manager,manager-gui,manager-script"/>
Added to pom.xlm: http://localhost:8080/manager/text
[INFO] Deploying war to http://localhost:8080/cliff-2.3.0
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2356/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2156/127150 KB
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 1.523 s]
[INFO] common ............................................ SUCCESS [ 1.718 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [ 0.359 s]
[INFO] cliff ............................................. FAILURE [ 12.664 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.735 s
[INFO] Finished at: 2015-08-26T11:04:23-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Broken pipe -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cliff
David-Laxers-MacBook-Pro:CLIFF davidlaxer$
When I set in the ~/.m2/settings.xml,it does not work. So I set in the pom.xml,like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat7-maven-plugin.version}</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<username>admin1</username>
<password>admin1</password>
<path>/${project.artifactId}</path>
<update>true</update>
</configuration>
</plugin>
And in $CATALINA_HOME/conf/tomcat-users.xml file, in <tomcat-users> element, add as follows:
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
<user username="admin1" password="admin1" roles="manager-script"/>
Then it works for me. :)
The role for deploying on /manager/text is "manager-script" and the Apache Tomcat Manager How-To indicates it shouldn't be applied to a user with the manager-gui role. I use a deployment user with only the manager-script role and no others, and that uploads the WAR file fine without the broken pipe message. If I add the manager-gui role to my deployment user, I get the broken pipe message you encounter. Try changing your tomcat-users.xml to limit Cliff's role to the single manager-script role. Hope it helps.
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
You may need to add this
<configuration>
..
<update>true</update>
..
</configuration>
to your pom.xml file to run
mvn tomcat7:deploy
I got this error when running mvn tomcat7:deploy instead of mvn tomcat7:redeploy.
If you're running CentOS, you may need to install additional management libraries:
yum install tomcat-webapps tomcat-admin-webapps
On other platforms solution may be similar.
I haven't been able to use the mvn redeploy shortcut since I merged in the code that split it into a few mvn modules. I recommend copying the .war file from webapp/target to the tomcat webapps dir on your computer/server.
May be you should check the webapps/manager/WEB-INF/web.xml file to ensure your .war file is smaller than the configured value.
<max-file-size>152428800</max-file-size>
<max-request-size>152428800</max-request-size>
See this question: IBM MobileFirst Platform 6.3 Operational Analytics Failed installation for Tomcat
if you already have the same application deploy on the tomcat server you need to undeploy it first. If you deploy it again it can give your the connection error.

Maven Tomcat7:deploy "Cannot invoke Tomcat manager: Connection refused: connect"

I'm trying to deploy my web app on Tomcat 7 with Maven (version 3.2.1), but getting exception listed in the title.
I've tried following solutions from questions (tomcat:deploy: "Cannot invoke Tomcat manager: Connection refused", Tomcat deployement issue in a Maven project):
Use tomcat user with manager-script role (respectfully edited settings.xml, pom.xml, tomcat-users.xml)
Deploy without specifying tomcat user.
Use diff maven commands e.g.: clean install tomcat7:deploy, clean tomcat7:deploy, tomcat7:redeploy, tomcat7:redeploy-only.
Also I should mention that if I'm running app on server without maven i.e. Project > Run As > Run on Server or using maven tomcat7-run goals i.e. clean install tomcat7:run then it all works as fine.
This is how I edit settings.xml, pom.xml, tomcat-users.xml when using tomcat user.
tomcat-users.xml:
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="user" password="pass" roles="manager-script"></user>
</tomcat-users>
settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<servers>
<server>
<id>apache-tomcat-7</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
</settings>
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example.company</groupId>
<artifactId>magazine</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>market Maven Webapp</name>
<url>http://maven.apache.org</url>
<build>
<finalName>${project.artifactId}</finalName>
<outputDirectory>${CATALINA_HOME}/webapps/${project.artifactId}/${project.artifactId}</outputDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>apache-tomcat-7</server>
<url>http://localhost:8080/manager/text</url>
<path>/${project.artifactId}</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</build>
...//dependencies
</project>
EDIT:
My Maven output with goals clean install tomcat7:deploy -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building market Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # magazine ---
[INFO] Deleting D:\git\magazine\target
[INFO] Deleting D:\EclipseWorkspace\apache-tomcat-7.0.59\webapps\magazine\magazine
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # magazine ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 19 source files to D:\EclipseWorkspace\apache-tomcat-7.0.59\webapps\magazine\magazine
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\git\magazine\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # magazine ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # magazine ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # magazine ---
[INFO] Packaging webapp
[INFO] Assembling webapp [magazine] in [D:\git\magazine\target\magazine]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\git\magazine\src\main\webapp]
[INFO] Webapp assembled in [376 msecs]
[INFO] Building war: D:\git\magazine\target\magazine.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # magazine ---
[INFO] Installing D:\git\magazine\target\magazine.war to C:\Users\Mark\.m2\repository\ua\khpi\norkin\magazine\0.0.1-SNAPSHOT\magazine-0.0.1-SNAPSHOT.war
[INFO] Installing D:\git\magazine\pom.xml to C:\Users\Mark\.m2\repository\ua\khpi\norkin\magazine\0.0.1-SNAPSHOT\magazine-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # magazine ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\git\magazine\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # magazine ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # magazine ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # magazine ---
[INFO] Packaging webapp
[INFO] Assembling webapp [magazine] in [D:\git\magazine\target\magazine]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\git\magazine\src\main\webapp]
[INFO] Webapp assembled in [221 msecs]
[INFO] Building war: D:\git\magazine\target\magazine.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine ---
[INFO] Deploying war to http://localhost:8080/magazine
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.622 s
[INFO] Finished at: 2015-03-08T11:09:46+02:00
[INFO] Final Memory: 25M/221M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project magazine: Cannot invoke Tomcat manager: Connection refused: connect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project magazine: Cannot invoke Tomcat manager
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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:483)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:742)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:705)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:388)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:82)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)
... 22 more
[ERROR]
[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
Also there is no log file in ${CATALINA_HOME}/logs - what I have is empty folder.
Besides there is no ${project.dir}/target/tomcat folder that I observed before.
Also should this option be checked ?

GWT Code Server not finding a module in a newly generated project using a maven archetype

I've worked with GWT and eclipse for a while now and I wanted to play a bit with maven and the GWT plugin (gwt-maven-plugin, enter link description here). I tried to use it out of eclipse (Luna 4.4), but obviously I didn't do it correctly, as it was extremely brittle to the point that it broke on a regular basis as the IDE overwrote it's settings when I changed something small in the pom.xml. So I decided to take a step back and eliminate the black magic that eclipse is and start a new project from scratch from the command line.
However, I cannot seem to be getting the hang of running the actual application, because when I execute the code server, navigate to the page, I see the following message:
Can't find any GWT Modules on this page.
Obviously, the code server is running, however the module files seem to not have been hosted. AFAIK I see after several hours of educating myself (and finding http://blog.ltgt.net/how-does-gwts-super-dev-mode-work/), there should be a second process actually hosting the code in parallel to the code server. What is the appropriate way of doing this with maven? Should I open a second terminal and run a jetty or something else in parallel to the code server? If so, could someone please give me a hint how I can do it most efficiently?
Thanks in advance!
Here is how I created the project:
mvn archetype:generate \
-DarchetypeGroupId=org.codehaus.mojo \
-DarchetypeArtifactId=gwt-maven-plugin \
-DarchetypeVersion=2.7.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [org.codehaus.mojo:gwt-maven-plugin:2.7.0] found in catalog remote
Define value for property 'groupId': : com.mytest
Define value for property 'artifactId': : gwtmvntest
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.mytest: : com.mytest.gwtmvntest
Define value for property 'module': : GwtMvnTest
Confirm properties configuration:
groupId: com.mytest
artifactId: gwtmvntest
version: 1.0-SNAPSHOT
package: com.mytest.gwtmvntest
module: GwtMvnTest
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: gwt-maven-plugin:2.7.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.mytest
[INFO] Parameter: artifactId, Value: gwtmvntest
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.mytest.gwtmvntest
[INFO] Parameter: packageInPathFormat, Value: com/mytest/gwtmvntest
[INFO] Parameter: package, Value: com.mytest.gwtmvntest
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: module, Value: GwtMvnTest
[INFO] Parameter: groupId, Value: com.mytest
[INFO] Parameter: artifactId, Value: gwtmvntest
[INFO] project created from Archetype in dir: /private/tmp/mvn/gwtmvntest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:12 min
[INFO] Finished at: 2015-01-14T12:59:17+01:00
[INFO] Final Memory: 15M/310M
[INFO] ------------------------------------------------------------------------
Here is how I compiled the project:
mvn compile gwt:compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GWT Maven Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:generateAsync (default) # gwtmvntest ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # gwtmvntest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # gwtmvntest ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /private/tmp/mvn/gwtmvntest/target/gwtmvntest-1.0-SNAPSHOT/WEB-INF/classes
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:compile (default-cli) # gwtmvntest ---
[INFO] Compiling module com.mytest.gwtmvntest.GwtMvnTest
[INFO] Compiling 5 permutations
[INFO] Compiling permutation 0...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 4...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 3...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 2...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 1...
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 13.866s
[INFO] Linking into /private/tmp/mvn/gwtmvntest/target/gwtmvntest-1.0-SNAPSHOT/GwtMvnTest
[INFO] Link succeeded
[INFO] Linking succeeded -- 0.171s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.228 s
[INFO] Finished at: 2015-01-14T13:07:07+01:00
[INFO] Final Memory: 22M/310M
[INFO] ------------------------------------------------------------------------
Here is how I ran the project:
mvn gwt:run-codeserver
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GWT Maven Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gwt-maven-plugin:2.7.0:run-codeserver (default-cli) > process-classes # gwtmvntest >>>
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:generateAsync (default) # gwtmvntest ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # gwtmvntest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # gwtmvntest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< gwt-maven-plugin:2.7.0:run-codeserver (default-cli) < process-classes # gwtmvntest <<<
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:run-codeserver (default-cli) # gwtmvntest ---
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO] workDir: /var/folders/nk/58gyq85x7l3_mzb5rc0gw42w0000gn/T/gwt-codeserver-5859907708379954718.tmp
[INFO] Loading Java files in com.mytest.gwtmvntest.GwtMvnTest.
[INFO] Module setup completed in 11742 ms
[ERROR] 2015-01-14 13:14:35.800:INFO:oejs.Server:jetty-8.y.z-SNAPSHOT
[ERROR] 2015-01-14 13:14:35.833:INFO:oejs.AbstractConnector:Started SelectChannelConnector#127.0.0.1:9876
[INFO]
[INFO] The code server is ready at http://localhost:9876/
With GWT 2.7+ all you need is to launch mvn gwt:run and it'll use SuperDevMode under the cover, with "recompile on load" (instead of using bookmarklets).
Note that gwt:run won't copy your src/main/webapp or your dependencies, so you'll likely have to run mvn war:exploded (or mvn package) as a prerequisite (and every time you change a file in src/main/webapp or you need to refresh your dependencies)
That being said, unless your project is really simple, you should start using distinct Maven modules early for client and server code; this is because Maven insists that you cannot manage a "GWT client-side classpath" and a "server-side classpath" in the same POM.
I published archetypes to help setting everything up: https://github.com/tbroyer/gwt-maven-archetypes (I unfortunately haven't had the time yet to update them to GWT 2.7)
Either that or use Gradle…

Categories

Resources