dependencies - maven warning: duplicate version when using two different types of dependecy of the same artifact -
maven throws strange warning while builduing our multi-module project. i'm referencing jar , test-jar of same project in project. both dependencies have test scope. im running maven 3.3.1 , cannot upgrade version easily.
does of have idea how solve problem without getting warning maven?
pom.xml of projecta:
<dependency> <!-- line 130 --> <groupid>${project.groupid}</groupid> <artifactid>projectb</artifactid> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupid>${project.groupid}</groupid> <artifactid>projectb</artifactid> <version>${project.version}</version> <scope>test</scope> </dependency>
warnings maven (anonymized):
[warning] problems encountered while building effective model org.group.projecta:1.0-snapshot [warning] 'dependencies.dependency.(groupid:artifactid:type:classifier)' must unique: ${project.groupid}:org.group.projectb:jar -> duplicate declaration of version ${project.version} @ org.group.projecta, /var/lib/jenkins/jobs/nicejob/workspace/org.group.projecta/pom.xml, line 130, column 15
looking @ test-jar documentation 2 artifact same one, , "test-jar" 1 not expected used aparte test phase since contains test classes.
a approach be:
- leave "standard" dependencies in compile scope (if need non-test classes provides)
- use "test-jar" dependencies additional dependency declaration (with test scope) of surefire-plugin only, it's used plugin itself
Comments
Post a Comment