Running tests from a test jar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Running tests from a test jar

Elliotte Rusty Harold
I'm attempting to run the tests in a test jar rather than from source,
for reasons. That is, I set up the pom.xml like so to run the tests
that are bundled in
com.google.cloud:google-cloud-storage:test-jar:tests

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <dependenciesToScan>
            <dependency>com.google.cloud:google-cloud-storage:test-jar:tests:*</dependency>
          </dependenciesToScan>
        </configuration>
      </plugin>
    </plugins>
  </build>

The problem I'm running into is that a lot, though not all,
dependencies seem to be non-transitive. I have to manually add the
various dependencies to the dependencies section. Is there any way
around this?

There's a more complete pom.xml here:

https://github.com/GoogleCloudPlatform/cloud-opensource-java/pull/2003/files



--
Elliotte Rusty Harold
[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Running tests from a test jar

Thomas Broyer-2
Dependencies declared with scope=test in the original project
(google-cloud-storage) won't come in transitively, you'd have to copy/paste
them.

Ideally, if that use case were to be officially supported, the project
would have to publish the tests as a normal JAR at different coordinates,
so it would have all its dependencies with scope compile (or runtime), and
you would get them transitively.

Le mer. 31 mars 2021 à 21:59, Elliotte Rusty Harold <[hidden email]> a
écrit :

> I'm attempting to run the tests in a test jar rather than from source,
> for reasons. That is, I set up the pom.xml like so to run the tests
> that are bundled in
> com.google.cloud:google-cloud-storage:test-jar:tests
>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <version>3.0.0-M5</version>
>         <configuration>
>           <dependenciesToScan>
>
> <dependency>com.google.cloud:google-cloud-storage:test-jar:tests:*</dependency>
>           </dependenciesToScan>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>
> The problem I'm running into is that a lot, though not all,
> dependencies seem to be non-transitive. I have to manually add the
> various dependencies to the dependencies section. Is there any way
> around this?
>
> There's a more complete pom.xml here:
>
>
> https://github.com/GoogleCloudPlatform/cloud-opensource-java/pull/2003/files
>
>
>
> --
> Elliotte Rusty Harold
> [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>