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.

16 comments
Comment actions Permalink

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.

0
Comment actions Permalink

There are no messages regarding this issue in the idea.log or the build.log files.  What else can I try?

0
Comment actions Permalink

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.  

0
Comment actions Permalink

Douglas,

There might be some configuration issues. That's why I ask you for logs.

0
Comment actions Permalink

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

0
Comment actions Permalink

Could you please attach screenshot from "Settings | Build, Execution, Deployment | Build Tools | Maven"?

0
Comment actions Permalink

Is it neccessary to use Maven 2?

0
Comment actions Permalink

yes, but I tried switching to maven 3 just to try the downloads and I get (names are obfuscated) :

 

2019-06-03 16:34:15,526 [1232946917]   INFO -      #org.jetbrains.idea.maven - org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.hibernate:hibernate-core:jar:sources:5.3.7.Final in file:///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of myRepo has elapsed or updates are forced 
java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.hibernate:hibernate-core:jar:sources:5.3.7.Final in file:///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of myRepo has elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1255)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1193)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1187)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1056)
at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find org.hibernate:hibernate-core:jar:sources:5.3.7.Final in file:///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of myRepo has elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 23 more
2019-06-03 16:34:15,591 [1232946982] INFO - pl.ProjectRootManagerComponent - project roots have changed
2019-06-03 16:34:16,775 [1232948166] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 1106ms; general responsiveness: ok; EDT responsiveness: ok
2019-06-03 16:34:17,016 [1232948407] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 241ms; general responsiveness: ok; EDT responsiveness: ok
0
Comment actions Permalink

I have reimported my project, its using maven3 now and in intellij I'm using the bundled maven3 and still cannot get sources:

2019-07-17 15:01:50,753 [192092152]   INFO -      #org.jetbrains.idea.maven - org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.hibernate:hibernate-core:jar:sources:5.4.2.Final in Internal-myProject (file://///home/user/workspace/project/build/mvn_repo/}) 
java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.hibernate:hibernate-core:jar:sources:5.4.2.Final in Internal-myProject (file://///home/user/workspace/project/build/mvn_repo/})
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1255)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1193)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1187)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1056)
at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.hibernate:hibernate-core:jar:sources:5.4.2.Final in Internal-myProject (file://///home/user/workspace/project/build/mvn_repo/})
at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 23 more
2019-07-17 15:01:50,784 [192092183]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2019-07-17 15:01:51,252 [192092651]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 402ms; general responsiveness: ok; EDT responsiveness: ok 
2019-07-17 15:01:51,288 [192092687]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 35ms; general responsiveness: ok; EDT responsiveness: ok 
2019-07-17 15:01:57,018 [192098417]   WARN - gin.utils.ProfilingUtilAdapter - YourKit controller initialization failed : To profile application, you should run it with the profiler agent 
0
Comment actions Permalink

What IDE version do you use? Could you please check the issue with IDEA 2019.2?

0
Comment actions Permalink

I was using 2019.1.1 and just downloaded 2019.2 and reproduce it:

 

2019-07-18 17:11:56,321 [ 624700]   INFO -      #org.jetbrains.idea.maven - org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:sources:1.0.0.Final in file://///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of Internal-myProject has elapsed or updates are forced 

java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:sources:1.0.0.Final in file://///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of Internal-myProject has elapsed or updates are forced

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:423)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:225)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:202)

at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:257)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.resolve(Maven3XServerEmbedder.java:1245)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.doResolve(Maven3XServerEmbedder.java:1195)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.doResolve(Maven3XServerEmbedder.java:1189)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.resolve(Maven3XServerEmbedder.java:1052)

at jdk.internal.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)

at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:sources:1.0.0.Final in file://///home/user/workspace/project/build/mvn_repo/} was cached in the local repository, resolution will not be reattempted until the update interval of Internal-myProject has elapsed or updates are forced

at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:219)

at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:192)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:564)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:482)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:400)

... 23 more

2019-07-18 17:11:56,355 [ 624734]   INFO - pl.ProjectRootManagerComponent - project roots have changed 

2019-07-18 17:11:56,836 [ 625215]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 399ms; general responsiveness: ok; EDT responsiveness: ok 

2019-07-18 17:11:56,914 [ 625293]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 78ms; general responsiveness: ok; EDT responsiveness: ok 
0
Comment actions Permalink

Is it possible to share a sample project to reproduce the issue?

https://youtrack.jetbrains.com/issue/IDEA-91662 could be the case.

0
Comment actions Permalink

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

0
Comment actions Permalink

.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.

0

Please sign in to leave a comment.