stackular
stackular

Reputation: 1471

Can Maven compile POM dependencies?

If a pom.xml contains a list of project dependencies like this:

<dependencies>
    <dependency>
        <groupId>com.myProject</groupId>
        <artifactId>my-project</artifactId>
        <version>1.0.5</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
</dependencies>

Does maven support some command line argument to recompile my-project?

Note: my-project is found in the CLASSPATH and could be specified using some XML element.

Upvotes: 2

Views: 94

Answers (2)

carlspring
carlspring

Reputation: 32697

Like Michael-O said, you the compile scope defines the point in time when you need this dependency (in this case during compilation).

The answer is no, but it is also doable.

Make all your modules produce a sources artifact. Then use the maven-dependency-plugin to extract them from the dependency tree into some directory. Using an invocation of the antrun-maven-plugin you can instruct Maven to compile these dependencies.

I frankly don't understand why you would want to do this, as your CI (continuous integration) server should already be deploying the binary + source artifacts to your artifact repository server.

Either way, I hope this helps.

Upvotes: 1

Michael-O
Michael-O

Reputation: 18415

No. Compile scope simply means that your dependency must be available at compile time of your app/library.

Upvotes: 5

Related Questions