-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added explicit decencies for surefile-junit4 in order to fix testing in offline mode. #3820
Conversation
Without this dependency explicitly listed java mvn dependency:go-offline will not pull it in and mvn -o verify will not work (Unless the tests have been run in online mode. In this case the cached surefire junit can still be used.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please pull these changes into the parent google-cloud-clients/pom.xml
. If it's affecting these 3 apis, then it will need to be fixed in all of them.
<dependency> | ||
<groupId>org.apache.maven.surefire</groupId> | ||
<artifactId>surefire-junit4</artifactId> | ||
<version>2.12.4</version> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…urefire version 2.17 [INFO] Building Google Cloud Java Compatibility Checker 0.67.1-alpha-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.17 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------ [INFO] Building Google Cloud API gRPC 0.32.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building proto-google-cloud-asset-v1beta1 0.32.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.17 is missing, no dependency information available [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Skipping grpc-google-cloud-asset-v1beta1 [INFO] This project has been banned from the build due to previous failures. [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building proto-google-cloud-automl-v1beta1 0.32.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.17 is missing, no dependency information available [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Skipping grpc-google-cloud-automl-v1beta1 [INFO] This project has been banned from the build due to previous failures. [INFO] ------------------------------------------------------------------------
All the versions of surefire should be the same within google-cloud-java. The version that other projects use is irrelevant as it is a test dependency - only used for building and running the tests this package. |
Discussed offline--we'll open another issue to fix the explicit dependencies
This change added |
Hello Coda,
I don't know why you mean by you can't run tests in Maven. I had no trouble
using maven to build and run these libraries in a number of ways and it
passes our tests (run in Maven). The reason I added
the org.apache.maven.surefire:surefire-junit4 dependency is to fix Maven's
ability to run the tests in offline mode. I'm no expert with Maven so if
know a better way to add said dependencies it would works for me. I just
need to make sure that it is still downloaded by "mvn
dependency:go-offline" so it can be run with "mvn -o verify". As far as I
can tell surefire-junit4 if requeres to run the tests on the library but
not pulled in by "mvn dependency:go-offline" unless it's listed as a
dependency. Is there a different place test dependencies are normally
included?
Sam Laane
…On Mon, Nov 19, 2018 at 2:42 PM Coda Hale ***@***.***> wrote:
This change added org.apache.maven.surefire:surefire-junit4:2.19.1 as a
compile dependency to most of the GCP SDKs, which makes it impossible to
depend on those SDKs and run tests in Maven.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3820 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHnyWzqR0tn_6BV0sLKCKg1K_HW7AWAks5uwzPigaJpZM4XdTBk>
.
|
The version of surefire-junit4 depended on directly via the SDK overrules the version required by the local Maven install and it results in the test runner crashing due to missing methods or other incompatibilities. You’re not seeing this problem because this change pins the version of surefire-junit4 to the specific version your local Maven install requires. My environment is different—a newer version of Surefire—and this breaks it. Maven dependencies have scopes—compile, provided, runtime, test, etc.—explicitly to limit transitivity of dependencies. This change adds the dependencies with the default scope—compile—and so every single project which depends on the SDK now also depends on a specific version of a specific Maven plugin. Not just in their build pipeline, but also in any JARs or WARs they produce. This is obviously not a good solution because nothing in the runtime code of these libraries even knows about Maven or JUnit, let alone depends on the code within. Now, as to the problem: <build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>2.22.1</artifactId>
<version></version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build> |
I see the problem and and more then happy to help you get a fix it. I have
a commit on my fork that moves surefire to be in the plugin section. Does
it work for your use case? If so I'll work the the maintainers to get it
merged to head.
silverdev@35feb8f
…On Mon, Nov 19, 2018 at 7:25 PM Coda Hale ***@***.***> wrote:
The version of surefire-junit4 depended on directly via the SDK overrules
the version required by the local Maven install and it results in the test
runner crashing due to missing methods or other incompatibilities. You’re
not seeing this problem because this change pins the version of
surefire-junit4 to the specific version your local Maven install requires.
My environment is different—a newer version of Surefire—and this breaks it.
Maven dependencies have scopes—compile, provided, runtime, test,
etc.—explicitly to limit transitivity of dependencies. This change adds the
dependencies with the default scope—compile—and so every single project
which depends on the SDK now also depends on a specific version of a
specific Maven plugin. Not just in their build pipeline, but also in any
JARs or WARs they produce. This is obviously not a good solution because
nothing in the runtime code of these libraries even knows about Maven or
JUnit, let alone depends on the code within.
Now, as to the problem: dependency:go-offline will pull in plugins in
addition to dependencies. You do not need to make your project depend on
all the dependencies of Maven itself to get offline builds to work. You
just need to list dependencies which are discovered at runtime—like
surefire-junit4—explicit dependencies of maven-surefire-plugin:
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>2.22.1</artifactId>
<version></version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3820 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHnyfCgE5edD_aJ5Z6beb4-DEkE3NJQks5uw3YxgaJpZM4XdTBk>
.
|
That should work, yes. |
…pache.maven.surefire:surefire-junit4:jar:2.20.1` and `dummy:dummy:jar:1.0` dependencies while offline Apparently the `surefire-junit4` dependency needs to be listed explicitly as the plugin's dependency, so that `mvn dependency:go-offline` could see it needs to be downloaded too. There was a nice discussion over here: googleapis/google-cloud-java#3819 googleapis/google-cloud-java#3820
Fixes #3819 (it's a good idea to open an issue first for context and/or discussion)