sbt / sbt-pom-reader

Translates xml -> awesome. Maven-ish support for sbt.
Other
76 stars 27 forks source link

test-jar not added to test classpath #38

Closed crispywalrus closed 8 months ago

crispywalrus commented 8 years ago

project A has several modules a,b module a has

      <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

in it's pom. this creates a test jar meant to contain classes useful for downstream modules. in module c there's this

        <dependency>
            <groupId>our.group</groupId>
            <artifactId>our.module</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <type>test-jar</type>
        </dependency>

problem is that this doesn't bring in the test jar. This works correctly in maven (insofar as anything having to do with maven is 'correct') The test dependency is added to the test class path and all the tests execute (and hopefully) pass.

How do I configure my sbt build to bring the test-jar artifact (or classes) into the test scope of my dependent project? I'm going to guess that the build plugin configuration isn't seen by sbt and so I need to configure project dependencies by hand in one of the sbt build files

metasim commented 8 years ago

I can't say off the bat that this is or isn't supported. The fact that you're using <type>test-jar</type> makes me suspicious. My gut says you'll have to add that to the dependency list explicitly in a build.sbt file.

dwalend commented 8 years ago

I see similar symptoms when compiling SHRINE ( https://open.med.harvard.edu/stash/projects/SHRINE/repos/shrine/browse?at=refs%2Fheads%2Fdevelop ) , with a similar pom entry:

    <dependency>
        <groupId>net.shrine</groupId>
        <artifactId>shrine-test-commons</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
    </dependency>

Grep shows three screens full, 118 incidents of <scope>test</scope> . I don't think an explicit list in build.sbts will scale for our project. Please add this feature.

Thanks,

Dave