I'm having some issues with a third party library that I'd like to step into. Netbeans provides a "Download Sources" option when the libraries node is right clicked. This downloads the sources from svn correctly, a source icon is attached to the dependency node, all is peachy. However, when I open one of the classes it gives me a generated skeleton just as it would if there was no source attached. Further more when there is a maven source present it seems there is no option to attach a local source manually so I can't work round this.
What are everyone else's experiences of this feature?
FYI the library in question is smack 3.1.0 http://www.igniterealtime.org/projects/smack/index.jsp
As Pascal writes, the resolution of source artifacts happens via convention, so if the dependency is at:
<dependency>
<groupId>com.yourcompany</groupId>
<artifactId>yourartifact</artifactId>
<version>1.2.3</version>
</dependency>
it will look for the source artifact at:
<dependency>
<groupId>com.yourcompany</groupId>
<artifactId>yourartifact</artifactId>
<version>1.2.3</version>
<classifier>sources</classifier>
</dependency>
So what you can do is download the source from the source download page, create a jar from it and run install:install-file as seen on the usage page:
mvn install:install-file -Dfile=your-created-source.jar \
-DgroupId=jivesoftware \
-DartifactId=smack \
-Dversion=3.1.0 \
-Dclassifier=sources \
-Dpackaging=jar \
-DgeneratePom=false
That way the convention will work and netbeans will find your sources automatically.
EDIT: added packaging
Netbeans provides a "Download Sources" option when the libraries node is right clicked. This downloads the sources from svn correctly, a source icon is attached to the dependency node, all is peachy.
If we're talking about Maven here, I don't think that this is what is happening. The Download Sources feature tells Maven to download a sources
artifact (e.g. foo-1.0-SNAPSHOT-sources.jar
) for a given dependency from a Maven repository. And obviously, this only works if a given dependency is providing a -sources
jar. But that's not the case of smack-3.1.0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With