How to disable auto-depend on the project but not

2019-06-09 02:40发布

I am using Maven in Intellij IDEA 11.1.2, and i am working on two different projects and one of them depends on the other one.

Project A's pom.xml as following

   <dependency>
        <groupId>project.b</groupId>
        <artifactId>project.b</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

Then IntellIj IDEA will automaticly depend on project B. Sometimes i can compile project A useing mvn command line, but the IDEA shows there are many errors in the source code, and the only way to fix this is removing the project b from the local file systems then removing it from the IDEA.

So i want to diable IDEA to auto-depend on the project but only the jar and do what the pom.xml tells it to do.

Thanks in advance.

2条回答
一夜七次
2楼-- · 2019-06-09 02:42

I believe you should tune dependency scope. Try specifying the scope as runtime - "This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath."

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-06-09 03:06

As @CrazyCoder said,

SNAPSHOT dependencies are resolved via project source location

I just accept the fact.

查看更多
登录 后发表回答