https://linen.dev logo
d

Davin Chia (Airbyte)

04/05/2021, 8:52 AM
are people able to run
AbstractJdbcSourceStandardTest
in their intellij? works for me on gradle but not in intellij
u

user

04/05/2021, 8:53 AM
it’s trying to find a non-existent path on intelilj e.g.
file:/Users/davinchia/.m2/repository/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/META-INF/versions/9
does not exist
u

user

04/05/2021, 8:53 AM
vs gradle
/Users/davinchia/code/airbyte/airbyte-integrations/connectors/source-jdbc/build/classes/java/test
u

user

04/05/2021, 8:54 AM
already tried setting the test’s module directory; no luck. what am I missing?
u

user

04/05/2021, 9:45 AM
this is coming from the
writeResource
method in the
MoreResources
class
u

user

04/05/2021, 9:45 AM
I ended up modifying the method to write to a file in the
tmp
directory instead of using the classloader for now. This seems better since with the classloader, there is no guarantee the class is being loaded from a location that can be written to. In the above example, my intellij is loading classes from within the
junit-platform-commons
jar, thus the funky
!
in the path
u

user

04/05/2021, 9:46 AM
I’m still curious what others think about this
u

user

04/05/2021, 4:45 PM
works for me in intellij
u

user

04/05/2021, 4:45 PM
are you using a custom run configuration somehow?
u

user

04/05/2021, 4:46 PM
I don’t have a
~/.m2/repository/org/junit/platform/junit-platform-commons/1.4.2/
directory
u

user

04/05/2021, 4:47 PM
Or maybe it’s accidental additions from command-entering a test dependency only at the intellij level?
u

user

04/05/2021, 10:17 PM
Weird
u

user

04/05/2021, 10:17 PM
Can you screen shot your intellij test config for me?
u

user

04/05/2021, 10:17 PM
I’m trying to run the abstract jdbc source test
u

user

04/05/2021, 10:27 PM
watch this work once I restart my intellij
u

user

04/05/2021, 10:28 PM
otherwise known as schrodinger’s class path
u

user

04/05/2021, 11:04 PM
this is still not working for me ugh
u

user

04/05/2021, 11:04 PM
Jared, what’s your working dir?
u

user

04/05/2021, 11:04 PM
the root airbyte directory
u

user

04/05/2021, 11:05 PM
I have absolutely nothing unique configured in my project
u

user

04/05/2021, 11:05 PM
Very intentionally
u

user

04/05/2021, 11:05 PM
I would be that if you created a new project from scratch in the airbyte dir and ran it the test would work
u

user

04/05/2021, 11:06 PM
I don’t think I have anything special configured as well..
u

user

04/05/2021, 11:09 PM
What about the module config?
u

user

04/05/2021, 11:12 PM
Also, do you have any non-“Gradle: ” libraries in the Libraries section?
u

user

04/05/2021, 11:17 PM
My dependencies tab looks similar. My Sources tab has one extra folder
u

user

04/05/2021, 11:17 PM
Also, do you have any non-“Gradle: ” libraries in the Libraries section?
Nope. Only see Gradle
u

user

04/05/2021, 11:19 PM
what about the specific dep
u

user

04/05/2021, 11:20 PM
I’m on Ultimate 2020.3.3
u

user

04/05/2021, 11:20 PM
I’m on the same version
u

user

04/05/2021, 11:21 PM
looks similar
u

user

04/05/2021, 11:21 PM
is your M2 cache populated?
u

user

04/05/2021, 11:22 PM
Are we still using local cache in this gradle set up? wondering what will happen if I blow my local cache away
u

user

04/05/2021, 11:22 PM
Copy code
→ ll ~/.m2/repository/org/junit/
ls: /Users/jrhizor/.m2/repository/org/junit/: No such file or directory
u

user

04/05/2021, 11:23 PM
I’m not sure why it’s looking for your maven cache in a gradle project
u

user

04/05/2021, 11:25 PM
I remember it’s possible to configure gradle to use the local maven cache. don’t think we are doing it though
u

user

04/05/2021, 11:25 PM
so not sure why too
u

user

04/05/2021, 11:25 PM
if you ./gradlew clean does it help anything?
u

user

04/05/2021, 11:25 PM
what does
ll ~/.m2
show for you?
u

user

04/05/2021, 11:26 PM
Copy code
# jrhizor in ~ [16:22:08]
→ ll ~/.m2/repository/org/
total 0
drwxr-xr-x  9 jrhizor  staff   288B Aug 21  2019 apache
drwxr-xr-x  4 jrhizor  staff   128B Aug 21  2019 beanshell
drwxr-xr-x  3 jrhizor  staff    96B Aug 21  2019 checkerframework
drwxr-xr-x  5 jrhizor  staff   160B Aug 21  2019 codehaus
drwxr-xr-x  4 jrhizor  staff   128B Aug 21  2019 hamcrest
drwxr-xr-x  5 jrhizor  staff   160B Aug 13  2020 jetbrains
drwxr-xr-x  6 jrhizor  staff   192B Aug 21  2019 slf4j
drwxr-xr-x  8 jrhizor  staff   256B Aug 21  2019 sonatype

# jrhizor in ~ [16:22:10]
→ ll ~/.m2/
total 0
drwxr-xr-x  18 jrhizor  staff   576B Aug 21  2019 repository
drwxr-xr-x   3 jrhizor  staff    96B Aug 21  2019 wrapper
u

user

04/05/2021, 11:26 PM
I have some stuff in there but very little
u

user

04/05/2021, 11:38 PM
ah
u

user

04/05/2021, 11:38 PM
it’s my intellij that’s populating/referencing the maven directory
u

user

04/05/2021, 11:39 PM
after removing the
junit
dir, Intellij lets me know it has to redownload it
u

user

04/05/2021, 11:39 PM
I think it’s because I’m using
intellij
to run the tests
u

user

04/05/2021, 11:39 PM
does that fix the original problem?
u

user

04/05/2021, 11:40 PM
no it doesn’t
u

user

04/05/2021, 11:40 PM
oh actually
u

user

04/05/2021, 11:40 PM
there’s a difference in that page
u

user

04/05/2021, 11:40 PM
I have it running through Gradle, not intellij
u

user

04/05/2021, 11:40 PM
for both build and run and test
u

user

04/05/2021, 11:40 PM
that’s my guess
u

user

04/05/2021, 11:41 PM
if you switch to Intellij, does this happen to you too?
u

user

04/05/2021, 11:41 PM
I get
java: error: invalid flag: -Xmx2g
u

user

04/05/2021, 11:42 PM
I think I’d have to change some other things to get it to work
u

user

04/05/2021, 11:43 PM
huh
u

user

04/05/2021, 11:44 PM
if I switch back now it shows me your original error
u

user

04/05/2021, 11:44 PM
oh but that was on the old run config
u

user

04/05/2021, 11:44 PM
switching back to the default test run config works again
u

user

04/05/2021, 11:45 PM
ah okay so this breaks if running the test with
intellij
then?
u

user

04/05/2021, 11:50 PM
it didn’t break the same way as you
u

user

04/05/2021, 11:50 PM
but it broke the same way as you if I set it to run as gradle but ran it with configuration from when it was configured to run as intellij
u

user

04/05/2021, 11:50 PM
🤷‍♂️
u

user

04/05/2021, 11:50 PM
I see
u

user

04/05/2021, 11:50 PM
which I don’t think is a very useful signal unfortunately
u

user

04/05/2021, 11:52 PM
have you been running test in
gradle
this entire time? I prefer
intellij
since logging is better
u

user

04/05/2021, 11:52 PM
yeah I’ve been running it through gradle the whole time
u

user

04/05/2021, 11:52 PM
generally logging seems ok
u

user

04/05/2021, 11:53 PM
u

user

04/05/2021, 11:57 PM
Is this the only situation you’ve run into this kind of problem?
u

user

04/05/2021, 11:57 PM
afaict this method is only used in testing so I think it’s a safer bet to write to a permanent location instead of something that changes depending on how classes are loaded
u

user

04/05/2021, 11:57 PM
writeResource
is only used for testing it looks like
u

user

04/05/2021, 11:57 PM
haha jinx
u

user

04/05/2021, 11:58 PM
haha
u

user

04/05/2021, 11:58 PM
yeah that change should be fine
u

user

04/05/2021, 11:58 PM
is the intellij running actually nicer for you in general?
u

user

04/05/2021, 11:58 PM
if this is fixed maybe i shoudl try switching
u

user

04/05/2021, 11:59 PM
yeah
u

user

04/05/2021, 11:59 PM
I find it faster
u

user

04/05/2021, 11:59 PM
and the logs are cleaner
u

user

04/05/2021, 11:59 PM
cool I’ll put up a PR later
u

user

04/06/2021, 12:00 AM
cool
u

user

04/06/2021, 12:00 AM
thanks for looking into this with me!
u

user

04/06/2021, 12:00 AM
ha np. wish I could have been more useful
3 Views