Can't download or attach sources
Answered
We have a separate testing repo. In our main app, we have that as a dependency. I am running tests and need to set a breakpoint inside this dependency. But it doesn't get the sources. When I click "download sources", it says sources not found. Even when I click "attach sources" and pick the source jar, it still says the same thing. I tried changing the maven from the built-in to the one brew installed on my Mac. Tried doing "mvn dependency:sources" from command line, where I can specifically see that it downloaded the sources for this dependency. But nothing makes any difference. What am I doing wrong? Running the latest greatest version of IntelliJ and plugins.
Please sign in to leave a comment.
Hello Douglas,
Please report issue on YouTrack attaching idea.log ("Help | Show Log in...") after restarting IDE and executing "download sources": http://youtrack.jetbrains.com/issues/IDEA.
There are no messages regarding this issue in the idea.log or the build.log files. What else can I try?
When I build my dependency, I am using `mvn clean source:jars install`. I can see the generation of the binary and source jars in the output. I can also see both jars in my local ~/.m2/repository directory. So the source jar is definitely there.
Douglas,
There might be some configuration issues. That's why I ask you for logs.
I have similar issue. When I click download sources it starts downloading the related jar and when it finishes it says "Cannot download sources:...". Into the log i see "Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.util.StringUtils" :
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003476140/comments/360000524700
Could you please attach screenshot from "Settings | Build, Execution, Deployment | Build Tools | Maven"?
Is it neccessary to use Maven 2?
yes, but I tried switching to maven 3 just to try the downloads and I get (names are obfuscated) :
You could try workaroud from this comment: https://youtrack.jetbrains.com/issue/IDEA-204711#focus=streamItem-27-3252008.0-0
I have reimported my project, its using maven3 now and in intellij I'm using the bundled maven3 and still cannot get sources:
What IDE version do you use? Could you please check the issue with IDEA 2019.2?
I was using 2019.1.1 and just downloaded 2019.2 and reproduce it:
Is it possible to share a sample project to reproduce the issue?
https://youtrack.jetbrains.com/issue/IDEA-91662 could be the case.
There are errors in some *.lastUpdated files in maven repo like this one:
cat /home/user/workspace/project/build/mvn_repo/org/springframework/spring-context/5.1.8.RELEASE/spring-context-5.1.8.RELEASE-sources.jar.lastUpdated
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Tue Aug 20 16:33:44 EEST 2019
file\://${maven.repo.local}/.error=Could not transfer artifact org.springframework\:spring-context\:jar\:sources\:5.1.8.RELEASE from/to Internal-myProject (file\://${maven.repo.local})\: Repository path ${maven.repo.local} does not exist, and cannot be created.
@default-Internal-myProject-file\://${maven.repo.local}/.lastUpdated=1566308024676
Found a workaround: manually execute maven source download with:
mvn -P myProfile eclipse:eclipse -DdownloadSources=true
.lastUpdated files are created by Maven when the download of this artifact was unsuccessful. The information from these files is then used for subsequent download tries.
To have IDE always use -DdownloadSources=true switch you can by enabling Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | Sources option.
Hello and Happy New Year 2023!
Unfortunately this is *still* an issue (how can be this so hard to resolve?!). Details follow:
Platform: IDEA Ultimate - Build #IU-223.8214.52, built on December 20, 2022
Host OS: Linux, PopOS 22.04 LTS, 64 bit, Gnome version 42.5
JDK: Open JDK 11.0.17
Project: maven based with a simple dependency on the kotlin stdlib
In File | Settings | Build, Execution, Deployment | Build Tools | Maven, Maven home path is set to Bundled (Maven 3).
In File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing I have set Automatically download: Sources, Documentation and Annotations.
Attempting to navigate from usage of `mapKeys` to definition. IDE shows "Decompiled .class file etc" view with options to Decompile to Java; Download Sources; Choose Sources ....
When I click Choose Sources, I can see the binary, sources and documentation jars for the Kotlin stdlib. I select the sources jar press Ok. But nothing happens.
I don't understand what I'm doing wrong. Honestly, I expect more from IDEA Ultimate (which I pay for!). I would be grateful if you can help me to fix this. Please don't ask me to open a ticket - this issue has been raised many times before and consistently fails to work. Thanks for your help.
This sounds like a different issue - with Kotlin libraries: KTIJ-23886 Cannot navigate to Kotlin standard library source code
Please vote for and flow the KTIJ-23874 issue.