How to debug springboot maven application in intellij - java

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

Related

quarkus-cucumber does not find step definitions

I'm trying to set up acceptance tests for a Quarkus app, using quarkus-cucumber 0.6.0 (on Quarkus platform version 2.15.2.Final), but it fails to find the step definitions.
My package structure looks as follows:
src
main
api
backend
gui
test
java
com.example.test
AcceptanceTest.java
steps
BlahSteps.java
BlubbSteps.java
specifications
blah.feature
blubb.feature
The AcceptanceTest.java specifies the package for the glue:
package com.example.test
#CucumberOptions(
features = "src/test/specifications",
glue = "com.example.test.steps"
)
public class AcceptanceTest extends CucumberQuarkusTest {
public static void main(String[] args) {
runMain(AcceptanceTest.class, args);
}
}
And the BlahSteps.java in that package contains methods for the steps in blah.feature. (It also ends up correctly in target/test-classes.)
Still, no matter whether I run mvn clean test in the terminal (or ./mvnw quarkus:test after annotating the AcceptanceTest with #QuarkusTest) or run the test in IntelliJ, it runs the blah feature and tells me:
You can implement missing steps with the snippets below:
...
Why is it not finding the glue? Am I missing something?
Configure surefire plugin like below
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/AcceptanceTest*.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
</configuration>
</plugin>
below you can see how cucumber triggered.
mintozzy#laptop:~/tmp/quarkus-cucumber-example$ mvn test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:quarkus-cucumber-example:jar:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for io.quarkus.platform:quarkus-maven-plugin is missing. # line 56, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------< com.example:quarkus-cucumber-example >----------------
[INFO] Building quarkus-cucumber-example 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # quarkus-cucumber-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/mintozzy/tmp/quarkus-cucumber-example/src/main/resources
[INFO]
[INFO] --- quarkus-maven-plugin:3.0.0.Alpha2:generate-code (default) # quarkus-cucumber-example ---
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) # quarkus-cucumber-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:3.0.0.Alpha2:generate-code-tests (default) # quarkus-cucumber-example ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # quarkus-cucumber-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) # quarkus-cucumber-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) # quarkus-cucumber-example ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.test.AcceptanceTestRunner
2023-01-16 20:05:56,769 INFO [io.quarkus] (main) quarkus-cucumber-example 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.2.Final) started in 2.091s. Listening on: http://localhost:8081
2023-01-16 20:05:56,771 INFO [io.quarkus] (main) Profile test activated.
2023-01-16 20:05:56,771 INFO [io.quarkus] (main) Installed features: [cdi, cucumber, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
Scenario: You're still alright # specifications/everything_is_fine.feature:9
Given you are having coffee # com.example.test.steps.EverythingIsFineSteps.you_are_having_coffee()
And there is a fire around you # com.example.test.steps.EverythingIsFineSteps.there_is_a_fire_around_you()
When you are still alright # com.example.test.steps.EverythingIsFineSteps.you_are_still_alright()
Then everything is fine # com.example.test.steps.EverythingIsFineSteps.everything_is_fine()
Scenario: You start to feel it # specifications/everything_is_fine.feature:14
Given you are having coffee # com.example.test.steps.EverythingIsFineSteps.you_are_having_coffee()
And there is a fire around you # com.example.test.steps.EverythingIsFineSteps.there_is_a_fire_around_you()
When you start to feel it # com.example.test.steps.EverythingIsFineSteps.you_start_to_feel_it()
Then panic # com.example.test.steps.EverythingIsFineSteps.panic()
2 Scenarios (2 passed)
8 Steps (8 passed)
0m0.893s
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.11 s - in com.example.test.AcceptanceTestRunner
2023-01-16 20:05:58,732 INFO [io.quarkus] (main) quarkus-cucumber-example stopped in 0.035s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.311 s
[INFO] Finished at: 2023-01-16T20:05:58Z
[INFO] ------------------------------------------------------------------------
here is the full code.

Maven Deploy to Tomcat

I want to deploy Maven based war file to Tomcat.
Technologies used :
Maven 3.1.1
Eclipse 4.2
JDK 7
Spring 4.1.1.RELEASED
Tomcat 7
Logback 1.0.13
I have this plugin in my maven file:
<!-- For Maven Tomcat Plugin -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/DevicesCloudWebApp</path>
<username>admin</username>
<password>admin</password>
<update>true</update>
</configuration>
</plugin>
but when I deploy using the command mvn tomcat7:deploy
I have this error:
[DEBUG] Connection 0.0.0.0:62265<->127.0.0.1:8080 closed
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package # DevicesCloudWebApp >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # DevicesCloudWebApp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # DevicesCloudWebApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # DevicesCloudWebApp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # DevicesCloudWebApp ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # DevicesCloudWebApp ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # DevicesCloudWebApp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [DevicesCloudWebApp] in [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/main/webapp]
[INFO] Webapp assembled in [97 msecs]
[INFO] Building war: /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package # DevicesCloudWebApp <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # DevicesCloudWebApp ---
[INFO] Deploying war to http://localhost:8080/DeviceslCloudWebApp
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp
2170/6062 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=%2FDeviceslCloudWebApp
2198/6062 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=%2FDeviceslCloudWebApp
2176/6062 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=%2FDeviceslCloudWebApp
2188/6062 KB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.922 s
[INFO] Finished at: 2016-12-02T20:57:29+01:00
[INFO] Final Memory: 16M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project DevicesCloudWebApp: 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
Try adding authentication configuration like below
<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>
Update the role configuration like below in the tomcat -> $CATALINA_HOME/conf/tomcat-users.xml in <tomcat-users> element
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
<user username="admin1" password="admin1" roles="manager-script"/>

Why maven-surefire-plugin skip tests with log message "because it has already been run for this configuration"?

I can't understand why maven-surefire-plugin doesn't run jUnit4 test. My pom is (can't add it here because "it looks post is mostly code"): http://pastebin.com/Jj3iJZpY
When I execute mvn clean test cmd window shows:
C:\Users\maya\git\services>mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building services 1.0.18
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # services ---
[INFO] Deleting C:\Users\maya\git\services\target
[INFO]
[INFO] --- maven-mule-plugin:1.9:attach-test-resources (default-attach-test-resources) # services ---
[INFO] attaching test resource C:\Users\maya\git\services\src\main\app
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:add-resource (add-resource) # services ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-mule-plugin:1.9:filter-resources (default-filter-resources) # services ---
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # services ---
[INFO] Compiling 60 source files to C:\Users\maya\git\services\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) # services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # services ---
[INFO] Compiling 1 source file to C:\Users\maya\git\services\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default-test) # services ---
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default) # services ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.554 s
[INFO] Finished at: 2015-12-11T15:48:05+03:00
[INFO] Final Memory: 48M/312M
[INFO] ------------------------------------------------------------------------
Test class is:
package com.comp.utils.UtilsTest;
import static org.junit.Assert.assertTrue;
import org.apache.log4j.Logger;
import org.junit.Test;
public class UtilsTest {
private static final Logger LOG = Logger.getLogger(UtilsTest.class.getName());
#Test
public void testHasPersonSameProd() {
boolean hasSameProduct = false;
assertTrue("Should be True", hasSameProduct);
}
}
Why maven-surefire-plugin:2.19 runs twice and doesn't want to run my test class? How to run test in my case? Thank you.
Given the pom you linked (which should be included into the question actually, as the link may be broken in the future):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>UtilTest.java</include>
</includes>
</configuration>
</plugin>
The Maven Surefire Plugin runs twice because you configured an additional execution of the plugin, without providing an id element and as such by default it is called default (maven-surefire-plugin:2.19:test (default)). This execution runs after the out-of-the-box Maven configuration for Surefire (maven-surefire-plugin:2.19:test (default-test)). So, as a consequence, you have two executions (default and default-test). Removing the executions section on the Surefire plugin configuration you would only have one execution (the default-test).
You also have a typo in the Surefire configuration, the <include>UtilTest.java</include> configuration points to the UtilTest.java class, while in your question it is named UtilsTest (note the additional 's').
If the test class is under src/test/java folder, then you don't need to configure its inclusion, since it also already follow the default convention of Surefire, "**/*Test.java".
The message you are having (Skipping execution of surefire because it has already been run for this configuration) is because your configuration element for the Surefire plugin is outside any executions element, which means is applied to all plugin executions, even the default one (default-test).
So you could probably remove the whole Surefire plugin section from your pom and the issue should be fixed.

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.

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