Several of their projects often need to reference each other, if the same as Maven project, how should it be referenced?
If a project needs to refer to the jar package generated by the B project, you only need to perform a Maven install operation on the B project
After you do this, the jar package is generated in the corresponding directory in your local repo
At this point a can add the dependency in its own pom.xml file, such as:
<dependency>
<groupId>xx.xx.xx</groupId>
<artifactId>A</artifactId>
<version>0.0.1</version>
</dependency>
While most of your projects are in the same package path, you can also use MAVEN built-in variables at this time, and maven commonly built-in variables are as follows:
- ${BASEDIR} Project root directory
- ${project.build.directory} build directory, default to target
- ${project.build.outputdirectory} build process output directory, default to Target/classes
- ${project.build.finalname} output name, default is ${project.artifactid}-${project.version}
- ${project.packaging} package type, default to Jar
- ${PROJECT.XXX} contents of any node of the current Pom file
At this point the above dependencies can also be modified to:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>A</artifactId>
<version>${project.version}</version>
</dependency>
You can use exclusion to add subkeys in dependency when there is a dependency conflict
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
References and built-in variables between maven-used MAVEN projects