I'm working with a user who is getting an error from a build that looks like 
this:
-------------------
Could not resolve dependencies for project 
<groupId>:<artifactId1>:bundle:2.0.0-SNAPSHOT: Could not find artifact 
<groupId>:<artifact2>:jar:tests
--------------

I elided the groupId and artifact ids, but the trailing part of the artifact 
reference was ":jar:tests".  I need to understand this "tests" thing.

I'm building the same branch, and I don't see this error, so I need to 
understand what's going on here.

The POM for "artifact1" has two dependencies on "artifact2".  One is the 
"default" artifact, and another is a jar artifact that is only used for unit 
tests.

The dependency elements in the POM for "artifact1" look like this:
-------------------
                <dependency>
                        <groupId>...</groupId>
                        <artifactId>artifact2</artifactId>
                        <version>2.0.0-SNAPSHOT</version>
                </dependency>
                <dependency>
                        <groupId>...</groupId>
                        <artifactId>artifact2</artifactId>
                        <version>2.0.0-SNAPSHOT</version>
                        <type>test-jar</type>
                        <scope>test</scope>
                </dependency>
-------------------

In the POM for "artifact2", there is the following plugin definition:
-----------
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-jar-plugin</artifactId>
                                <version>2.2</version>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>test-jar</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
-----------

Notice that the only place you see "tests" so far is in that error message 
(which my colleague gets, but I do not).

I then looked in the "target" directory for "artifact2", and I saw the 
following:
-----------------
artifact2-2.0.0-SNAPSHOT.jar
artifact2-2.0.0-SNAPSHOT-tests.jar
----------------

Ok, there's the "tests".  The question is, how did I end up with "*-tests.jar"?

I'm also unsure of the proper way to generate an "auxiliary" jar like this. 
Perhaps this should be refined to be more robust?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to