[CLOSED – I had to move classes from test/java to main/java and update the maven repository via the IDE “maven options”]
I’m new to maven and inexperienced with java development. I’m using IntelliJ Idea as IDE. I’m using Maven 3.0.4.
I created a “project A” and a “project B”, each with some classes. Now when I try to create a dependency in project A to a class in project B I can’t seem to find any classes that are part of project B. When I check the maven repository I can see that a .jar file is created based on project B.
To clarify: when adding a dependency to project B I do find an artifact called “project B” but I cannot find any classes that are part of project B.
It doesn’t seem like I can access and use any of the classes that are part of project B inside project A which would make this installation worthless.
—
Please tell me what information I should include for you to help me solve this problem.
[EDIT] Here is the project A‘s pom with a dependency on project B. However I either don’t understand how to use it in my project or it doesn’t work. While I can use IntelliJ’s functionality to find and add the artifact, intelliJ can’t seem to find any classes that are part of project B (while it does find classes that are part of other pre-defined packages in the maven repository):
<?xml version="1.0" encoding="UTF-8"?>
<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>planet</groupId>
<artifactId>planet</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>toolbox</groupId>
<artifactId>toolbox</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
I had to move my classes from test/java to main/java. Silly, but it took me a whole day to realise this. This only worked after updating the repository in “maven options” via the IDE.