1

This is my first Spring Application ever. I am trying to display Hello,World in my browser. I followed the steps below, but something is wrong with my dependencies. I am using Intellij 1.2017

On Intellij:

  • Import project
  • choose ../initial/pom.xml
  • Next -> selected org.springframework:gs-maven:0.1.0 -> jdk 1.8 -> Finish
  • run: everything works fine up to here.

Now I want to dispaly Hello, World! in the browser, follwoing the steps here: http://projects.spring.io/spring-boot/

  • Added class SampleController
  • Modified pom.xml to be as follows:
<modelVersion>4.0.0</modelVersion>
    <groupId>org.springframework</groupId>
    <artifactId>gs-maven</artifactId>
    <packaging>jar</packaging>
    <version>0.1.0</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>hello.HelloWorld</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
  • right click on project, and add framework support -> Added spring
  • Getting: cannot resolve symbole boot, and : cannot resolve symbole EnableAutoConfiguration

enter image description here

I do not have much experience on maven, and dependencies, hence I am trying to follow the instructions literally. What could be wrong in my steps?

Community
  • 1
  • 1
Hawk
  • 5,060
  • 12
  • 49
  • 74

1 Answers1

0

Explaining comment from – Mohsan Shakir

  1. Click on "View" and enable "Tool Buttons".
  2. On the right panel click on "Maven Projects"
  3. Add (by click on +) you project (find the pom file).
  4. Click the leftmost button on the maven panel "Reimport All..."
StanislavL
  • 56,971
  • 9
  • 68
  • 98
  • Thank you. I did that. But it did not help. names are still resolved! – Hawk Apr 07 '17 at 08:24
  • Did you install Maven properly? Do you have M2_HOME etc? If yes try to specify the Idea Maven setting on the same panel and point to your maven dir – StanislavL Apr 07 '17 at 08:31