6

I have wanted to learn Spring MVC and I took look at javavids - YouTube, I wanted to follow along with this series but I have multiple problems/issues First I rebuild the Global repo in Maven Repositories

Solved

enter image description here

then I created Maven project but structure in videos was

enter image description here

but I have this instead

Solved

enter image description here

OK now I want to add plugins to pom.xml but getting this dialog in videos it shows :

UPDATE
enter image description here
I don't get any plug-in to select from
enter image description here
Solved
I also have compiler compliance enter image description here when I set compiler to java 1.7 then I get
Solved
enter image description here

and at last when I tried to update STS 3.6.3 It freezes and shows enter image description here
OK
I have proxy settings as

enter image description here

Update I make changes and add dependency according to this Answer
I get this error:
enter image description here
Now I don't see resources which can help me to get these remaining issues resolved! any help is highly appreciated.

Community
  • 1
  • 1
Arshad Ali
  • 3,082
  • 12
  • 56
  • 99

4 Answers4

1

First maven default compiler level is set to 1.5. In order to set it to 1.7 either configure maven-compiler-plugin

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
</plugin>

or add the following properties.

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>

After setting java version press Alt+F5 to update maven project.

In order to search for dependency or plugins go to Window -> Preferences -> Maven and check Download repository index update on startup

Restart STS, wait for index updates to complete.

Regarding your project structure check do have <packaging>war</packaging> in your pom.xml. By default it will be jar type.

K. Siva Prasad Reddy
  • 11,786
  • 12
  • 68
  • 95
1

then I created Maven project but structure in videos was

You be able to switch the perspective in the ide (eclipse). In the video that is the Java EE-Perspective.

That what you got is the Spring-Perspective, don't worry about that.

Window -> Open Perspective

OK now I want to add plugins to pom.xml but getting this dialog

Ok, what is wrong with that?

If you searching for a dependency on MVN Repository there you got all informationen to fill out the informations you see in the dialog. Otherwise you can open the pom-file and paste the dependency directly.

I also have compiler compliance

Assuming that you are using the m2e plugin in Eclipse, you'll need to specify the source and target versions as 1.7 for maven-compiler-plugin.

specify it with this:

<properties>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.source>1.7</maven.compiler.source>
</properties>

And update your project Right click on project -> maven -> update project (Alt F5)

The network seems to be ok. Are you on a privat or office network?

Manu Zi
  • 2,300
  • 6
  • 33
  • 67
  • If I have to install maven as stand alone or it is OK which ships/comes with Spring Tool Suite? – Arshad Ali Jun 01 '15 at 14:16
  • I want to add _plug-in_ in pom.xml but select plu-in don't show any to add? – Arshad Ali Jun 01 '15 at 14:42
  • please follow this guide: https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html add the dependency like i suggest it in the post – Manu Zi Jun 01 '15 at 16:40
1

I would also like to recommend to get started with Spring using the Spring Tool Suite by using Spring Boot and the guides at http://spring.io/guides. You can import those guides directly into STS and start from there (assuming you have network connectivity).

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
1

I think the solution I am providing here will dam sure will work for you. If you have downloaded Spring STS successfully then you have to follow these steps only.

Select New Project

Select SPring Project

Enter Project name

After creation of project right click on project and Update Maven Project

For Integrating it with Google App Engine it is very Simple. You have to just declare the google app engine dependency in you pom.xml. I am providing you the structure of my Google App engine Spring project.

Please follow these steps 1. create appengine-wex.xml under WEB-INF Folder 2. Create logging.properties file under WEB-INF Folder 3. Insert Google App engine dependecies

Here is sample appengine-web.xml

    <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xml>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <application>make-me</application>
  <version>2</version>

  <!--
    Allows App Engine to send multiple requests to one instance in parallel:
  -->
  <threadsafe>true</threadsafe>

  <!-- Configure java.util.logging -->
  <system-properties>
    <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
  </system-properties>

  <!--
    HTTP Sessions are disabled by default. To enable HTTP sessions specify:

      <sessions-enabled>true</sessions-enabled>

    It's possible to reduce request latency by configuring your application to
    asynchronously write HTTP session data to the datastore:

      <async-session-persistence enabled="true" />

    With this feature enabled, there is a very small chance your app will see
    stale session data. For details, see
    http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions
  -->

</appengine-web-app>

Pom dependency

<dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>1.9.1</version>
        </dependency>

        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-testing</artifactId>
            <version>1.9.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-stubs</artifactId>
            <version>1.9.1</version>
            <scope>test</scope>
        </dependency>

Final Structure

enter image description here

Make
  • 422
  • 2
  • 6
  • 17
  • OK! in that way I some how managed to create Spring project, but I have issue with adding google App Engine extension and [Apache tiles 3](http://stackoverflow.com/questions/30694735/cannot-locate-beandefinitionparser-for-element-bean) I want to get these issues solved as well – Arshad Ali Jun 11 '15 at 14:40