3

I have java application and deployed in a folder A. But I want to run mvn commands(mvn clean install) from folder B. Is that possible?

Prasith Prabhu
  • 211
  • 4
  • 16

2 Answers2

8

Use the parameter -f then specify the path to your pom file, for example : mvn -f /path/to/pom.xml

This runs maven for the working directory.

Omid
  • 314
  • 1
  • 13
-1

If you want to build multiple projects, you can create a xml file like below and then use mvn clean install

<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.myProject</groupId> <artifactId>full-build</artifactId> <version>0.0.1</version> <name>My Project Name</name> <description>Full build of the Projects.</description> <packaging>pom</packaging> <modules> <module>path of module 1</module> <module>path of module 2</module> <!-- You can even use relative path --> <module>../folder1/relativePath/module 3</module> </modules> <dependencies> // if any </dependencies> </project>

Rahul Agrawal
  • 623
  • 1
  • 5
  • 18