Skip to content
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

Compile not working / Oracle JAR requires authorization #27

Closed
cruftex opened this issue Jul 28, 2018 · 11 comments
Closed

Compile not working / Oracle JAR requires authorization #27

cruftex opened this issue Jul 28, 2018 · 11 comments

Comments

@cruftex
Copy link

cruftex commented Jul 28, 2018

When I do

mvn clean test-compile

There is the error:

[ERROR] Failed to execute goal on project high-performance-java-persistence: Could not resolve dependencies for project com.vladmihalcea.book:high-performance-java-persistence:pom:1.0-SNAPSHOT: Failed to collect dependencies at com.oracle.jdbc:ojdbc8:jar:12.2.0.1: Failed to read artifact descriptor for com.oracle.jdbc:ojdbc8:jar:12.2.0.1: Could not transfer artifact com.oracle.jdbc:ojdbc8:pom:12.2.0.1 from/to maven.oracle.com (https://maven.oracle.com): Not authorized , ReasonPhrase:Authorization Required. -> [Help 1]

When removing the Oracle dependency compilation works.

Probably the Oracle JDBC cannot be obtained from Maven central. One solution would be to put the Oracle dependency in a separate Maven profile.

@vladmihalcea
Copy link
Owner

The README tells exactly what you have to do.

@cruftex
Copy link
Author

cruftex commented Jul 28, 2018

@vladmihalcea please reconsider this. That is a bad OOTB experience.

Where is it written in the README that I need to register with Oracle to run the tests against PostgreSQL?!

@cruftex
Copy link
Author

cruftex commented Jul 28, 2018

BTW, the README says exactly:

The Unit Tests are run against HSQLDB, so no preliminary set-ups are required.

How should I do this?

@vladmihalcea
Copy link
Owner

Just comment the Oracle repository if you don't want to set it up. The tests compile even without the Oracle JDBC Driver.

@cruftex
Copy link
Author

cruftex commented Jul 28, 2018

Sure, that's what I did. However, a lot of other people will have the same experience and need to do the same.

If you like, I can do a PR with a suggestion how to solve this with a Maven profile.
To run the tests with Oracle one would need to do mvn -Poracle test then.
In IntelliJ you can enable the profiles in the Maven tool window.

I did something similar here:
https://github.com/cruftex/jsr107-test-zoo/blob/master/pom.xml

If you don't like the idea, that's okay too.

The project is really nice!

Ultimately I would recommend working towards something like:

# run the tests with embedded SQL:
mvn test
# run the integration tests with Oracle:
mvn -Poracle verify
# run the integration tests with MySQL:
mvn -Pmysql verify
# run integration tests for performance on PostgreSQL:
mvn -Pperformance,postgresql verify

@vladmihalcea
Copy link
Owner

I'll use a profile activated by an environment variable.

@vladmihalcea vladmihalcea reopened this Jul 28, 2018
@vladmihalcea
Copy link
Owner

Fixed. The Oracle repo must now be activated explicitly.

@cruftex
Copy link
Author

cruftex commented Jul 28, 2018

@vladmihalcea please mind that you need to move the JDBC driver dependency into the profile as well.

@vladmihalcea
Copy link
Owner

The driver scope is provided so it won't be required during compile. So, it should be just fine.

@cruftex
Copy link
Author

cruftex commented Jul 28, 2018

Scope provided means that it is not packaged, since present at the target environment.
It's used for compiling.

If you don't want it in the compile scope, then the scope runtime is the correct one.
However, runtime would be present during running the tests.

@vladmihalcea
Copy link
Owner

You're right. Unfortunately, Maven does not have a test-runtime scope, so only moving the dependency to the oracle profile does the trick. I pushed a new change to do that. Thanks for the tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants