1

I have source code of some library, which is made under Maven. When I downloaded it with Eclipse, it didn't recognize it as Java project. Event if I assign Maven nature to, the Java nature does not appear (apparently for me).

The means, that the only thing I can do with this project -- is to run Maven goals.

This would be OK if standalone.

Let's call project above as "source" project.

Now I want to use source project's jar (it produces some jars) as the dependency for another project, which will be called "destination" project.

If I try to use standard Java Build Path dialog, where I can refer other projects, source project is not even listed. This is why I say Eclipse does not see it is as Java project.

But may be it is possible to refer source project with pom.xml of destination project?

Source project has the following pom:

<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>
  <parent>
    <artifactId>piccolo2d-parent</artifactId>
    <groupId>org.piccolo2d</groupId>
    <version>2.0-SNAPSHOT</version>
    <relativePath>./parent/pom.xml</relativePath>
  </parent>
  <artifactId>piccolo2d-complete</artifactId>
  <packaging>pom</packaging>
  <name>Piccolo2D</name>
  <scm>
    <connection>scm:svn:http://piccolo2d.googlecode.com/svn/piccolo2d.java/trunk</connection>
    <developerConnection>scm:svn:https://piccolo2d.googlecode.com/svn/piccolo2d.java/trunk</developerConnection>
    <url>http://code.google.com/p/piccolo2d/source/browse/piccolo2d.java/trunk</url>
  </scm>
  <build />
  <reporting />
  <modules>
    <module>parent</module>
    <module>core</module>
    <module>extras</module>
    <module>swt</module>
    <module>examples</module>
    <module>swt-examples</module>
  </modules>
</project>

Is it possible to write something in destination's project's pom.xml, so that it refer source project?

If I set normal tag then it probably will go to global repository and take it from there.

What to do? May be I should rename source project artifact or something?

May be "SNAPSHOT" name works for this? I want to add some functionality to Piccolo.

UPDATE

I have referred to one of subproject's ids in my "destination" project and Eclipse found it somewhere. But I am not sure it took it from my workspace. Most probably it took it from global repository. Also I can't download any source code insid "destination" project. This also means that probably Eclipse does not put artifacts from workspace into repository.

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

0

You 'source' project has pom. This means that it is not a Java project on its own, it is a container for projects like 'core', 'extras' etc.

In you destination project, you need to add a to one or more of the sub-projects, not the source project itself. For example, to add the core module (assuming it has artifactId piccolo2d-core, add the following to the destination pom.xml:

<dependencies>    
   <dependency>
    <groupId>org.piccolo2d</groupId>
    <artifactId>piccolo2d-core</artifactId>
    <version>2.0-SNAPSHOT</version>
   </dependency>
<dependencies>

If the projects are imported in the same Eclipse workspace, Eclipse will add the referenced sub-projects as Project References in the Java Build Path.

GeertPt
  • 16,398
  • 2
  • 37
  • 61