Rajkishan Swami
Rajkishan Swami

Reputation: 3759

Maven Dependencies Not Imported in IntelliJ 14.1.4

While doing a test project, i added below dependency at a later stage,

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

But if i try to import @RunWith, it says invalid name.

See the picture below,

enter image description here

What i have tried?

1 - Changing Maven settings to "Auto-Import".

2 - Updated "Repositories" in maven settings.

3 - Selected "ReImport" in the maven options.

I am very new to this IDE. Am i missing something?

Upvotes: 2

Views: 120

Answers (1)

ashur
ashur

Reputation: 4307

You have added this dependency to the test scope. You must create a test module and use it there. Under src directory create test/java directory and put there your packages with tests.

Right click on the src directory and go to New -> Directory, then type test/java, next right click on the created java directory and on the most bottom part you should see Mark Directory As, choose Test Sources Root

Upvotes: 1

Related Questions