fstn
fstn

Reputation: 149

Maven, how to access class from an other artifact

I made 3 artifacts Common Config and Full in my Full pom I had:

        <dependency>
            <groupId>fr</groupId>
            <artifactId>Common</artifactId>
            <version>1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>fr</groupId>
            <artifactId>pConfig</artifactId>
            <version>1</version>
            <scope>compile</scope>
        </dependency>

And in my Full artifact code source I tried to access to Config class and It didn't work. Maven install works but I had an Error in Eclipse: import fr.datacontrol.DataSources; I has: the import cannot be resolved... Do you have an Idea? Thank you

Upvotes: 0

Views: 765

Answers (1)

Andrew Spencer
Andrew Spencer

Reputation: 16484

If it's working in Maven but not in Eclipse, that means you don't have the same build path in Eclipse that you have in Maven. Which probably means that Eclipse isn't using the information in the POM when it builds your project.

You might need to install the m2e plugin in Eclipse - though I think it's included by default from Indigo onwards.

Or you might simply need to tell Eclipse that it's a Maven project: right-click on project -> Configure -> Convert to Maven project (in Indigo)

Upvotes: 1

Related Questions