Tuesday, 15 September 2015

Add one Java program as a dependency in another program using Maven. -



Add one Java program as a dependency in another program using Maven. -

there many related questions getting confused answers them , decided inquire myself. have java programme , want utilize in one. how can add together first 1 dependency in pom.xml file of sec program? ide using intellij version 13.

suppose pom.xml of project a

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.a</groupid> <artifactid>a</artifactid> <packaging>jar</packaging> <version>1.0</version> <name>a</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>

after compile project through mvn install command, can add together project project b using <dependency> of project a

suppose pom.xml of project b

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.maventest</groupid> <artifactid>mytest2</artifactid> <packaging>jar</packaging> <version>1.0-snapshot</version> <name>b</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>com.a</groupid> <artifactid>a</artifactid> <version>1.0</version> <scope>compile</scope> </dependency> </dependencies> </project>

see more info : how add together project dependency of project?

java maven intellij-idea

No comments:

Post a Comment