I have created 2 dummy projects by start.spring.io (Maven, Java):
com.example.lioncom.example.zoo
I want to import lion project to zoo project as dependency.
So I go to lion folder and execute:
mvn clean install mvn install:install-file -Dfile=target/lion-0.0.1-SNAPSHOT.pom -DpomFile=pom.xml Then I add dependency to zoo pom.xml:
<dependency> <groupId>com.example</groupId> <artifactId>lion</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> After that I execute mvn clean install in zoo folder.
I never got errors in console.
So now if I go to any class in zoo project, and import:
import com.example.lion.*; Then mvn clean install, I get error:
package com.example.lion does not exist
In my IntelliJ IDEA I can see, that lion dependency is in External Libraries and maven-tool, but why I can not access that from code?
com.example.lionactually have a java package incom.example.lion? By this i mean does yoursrcdirectory for the lion project have the childrenmain/java/com/example/lion?com.example.lionto import in the zoo project.mvn install:install-file ...explicitely in addition tomvn install! Theinstallphase (invoked with the former executed) has the Install Plugin'sinstallgoal bound to it by default which does this automatically for you, by using the project's POM declarations of the Maven Coordinates<groupId>,<artifactId>,<version>(GAV).mvn installnow, but the problem is not solved