Question

I am trying to run the samples from http://projects.spring.io/spring-security/

this guide explains how to run the insecuremvc sample from Spring Tool Suite (STS): http://docs.spring.io/spring-security/site/docs/3.2.x/guides/hellomvc.html

How can I run the sample from the command line (instead of from STS)?

I've tried adding the following to pom.xml -> project/build/plugins:

  <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
      <path>/</path>
      <uriEncoding>UTF-8</uriEncoding>
      <hostName>localhost</hostName>
      <port>8080</port>
      <update>true</update>
      <useTestClasspath>true</useTestClasspath>
    </configuration>
  </plugin>

and running

$ mvn package tomcat7:run

but browsing http://localhost:8080/sample/
I get a HTTP Status 400 - The request sent by the client was syntactically incorrect.

Solution based on Luke's answer

$ git clone https://github.com/spring-projects/spring-security.git
$ cd spring-security/samples/insecuremvc
$ ../../gradlew tasks
# this shows several defined tasks, tomcatRunWar among them
$ ../../gradlew tomcatRunWar
Was it helpful?

Solution

I'm not sure what the problem here is, but if you are just interested in running Spring Security samples, there are lots in the project source tree itself.

$ git clone git@github.com:spring-projects/spring-security.git
$ cd spring-security/samples/tutorial-xml
$ ../../gradlew jettyRun

will give you a running server. You can also use a local gradle installation instead of the wrapper included in the project. The initial build will take a while, but there are lots of sample projects in there which you can run afterwards, showing both XML namespace and Java configuration options.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top