Avoid javadoc and sources downloading, when using Maven ant Tasks - maven-2

I'm developing with Maven Ant Tasks support. When asking the repository to download desired libraries, it also downloads javadoc and source for each library. Is there a way to only download library jars?
Actual build.xml:
<artifact:dependencies settingsFile="${maven.settingsFile}" pomRefId="projectPom"
filesetId="dependency.fileset"
sourcesFilesetId="sources.dependency.fileset"
javadocFilesetId="javadoc.dependency.fileset"
versionsId="dependency.versions">
<remoteRepository refid="remote.repository" />
</artifact:dependencies>

As far as I know the src and javadoc downloads are off by default. There should be an option in your IDE or whatever tool you use for Maven.
Are your working with Eclipse?
In Eclipse you can find the option here:
Window > Preferences > Maven
Then tick the checkboxes (or rather untick them) 'Download Artifact Sources/JavaDoc'.

That's strange. Most open source Maven modules don't have source and javadoc on the default "compile" Maven scope. Have you tried specifying a scope?
<artifact:dependencies filesetId="dependency.fileset" useScope="compile">
..
Alternatively you can also specify a "scope" attribute on each dependency.
Personally I use the ivy plugin for my Maven downloads. The same problem is solved by specifying the "default" or "compile" configuration mapping: ivy: prevent downloading sources and .txt files

Finally solved: just remove sourcesFilesetId and javadocFilesetId attributes if you don't need sources and javadoc jar libraries.

Related

What option to select when cloning Git project in IntelliJ?

I have cloned Gradle project from GitHub in IntelliJ and then got the following dialog:
Should I select "existing sources" because my sources exist and not external, or should I select "external model" because it has Gradle specification?
You should choose Gradle becouse only this way the IDE will properly find and use build.gradle files.
You should choose external model. You want IntelliJ to look at your Gradle file and decide how to set itself up based on what is in your Gradle file.
You use the existing sources option when you don't have Gradle file or Maven pom and you need IntelliJ to look at the sources and figure out what to do without a file to guide it.
There is some documentation here: https://www.jetbrains.com/help/idea/2016.3/creating-a-project-by-importing-existing-sources.html

Add source repositories for "Search in internet" in IDEA

When the source of an artifact can't be found, IDEA proposes to "Search in internet" or "Attach sources". Is there a way to add a new location to the repositories IDEA checks when choosing the "search in internet" option?
Essentially, you need to add repositories to IntelliJ Idea's "Index Maven Repositories" which are indexed for these types of proposals. Depending on the type of project (maven, gradle, ant, lein, sbt), the best answer will be different. In maven, you would normally edit your pom.xml file. In gradle, you would normally edit your build.gradle file. I don't know what build system you want to use (or if you want one).
If your projects are Maven projects, you can look at maven documentation to see how to add another maven repository in your settings.xml file. On a project by project basis, you can add the repository to the pom.xml file instead.
Similarly, if you're using gradle then look at gradle's documentation (Section 8.5) to add a maven repo to your projects build.gradle file.
Once IntelliJ Idea updates its indices, it will check the repositories that your project is configured to use for artifacts when it makes its proposals.

How to add dependent jars to deploying plug-in

I would to like to add the dependent jars to the update site plugin project in Eclipse.
I followed
http://wiki.eclipse.org/FAQ_How_do_I_create_an_update_site_%28site.xml%29%3F
but, it does not address the above issue. How to deal with the dependent jars with deploying plugin? Anybody please help with ideas.
Thanks
I'm going to assume you are wanting to add additional Jar files to your plugin. You can do this by simply putting the Jar files into the top level directory of your plugin, and in the Classpath portion of the Runtime tab in the Plugin Manifest Editor you can specify the Jar file. This will automatically add it to the build path as well.
Some people prefer to make an extra plugin that contains nothing but external Jar files; you add the Jar files to this extra plugin the same way and then just use the Dependencies tab in the Plugin Manifest Editor to make your original plugin dependent on the Jar plugin.

How to convert Ant project to Maven project

How to convert a Ant project to Maven project? A sample project that would link (a Wicket project)
Thanks
The nice part of using maven is that most standard stuff works automatically once you do things the maven way. For a simple webapp:
Create a pom with groupId, artifactId and version (packaging: war)
Add the required dependencies to the pom
move the
java sources to src/main/java,
resources to src/main/resources,
webapp content to src/main/webapp,
test content to src/test/java and src/test/resources
set the compiler compliance version using the maven compiler plugin
That should get you up 'n' running.
http://www.sonatype.com/people/2009/04/how-to-convert-from-ant-to-maven-in-5-minutes/
I don't know what your ant script looks like, but assuming its a basic script for building, you will need to create a pom.xml file for your project, add your dependencies, and then build it via maven.
For anyone who lands here in future, there is an easier way to find dependencies for maven using the file hashes. So, you won't have to guess artifact versions.
As per the below article, the idea is to generate a SHA1 checksum of the dependency that you want to find the information, then do a reverse search in Nexus repository manager using that hash. For the checksum generation, you can use Microsoft's FCIV (free) utility.
https://devreads.xyz/ant-to-maven-conversion-the-painless-method/

Getting lift sources from maven repository

I'm trying to learn how to use lift. I can create project skeleton by running maven commands (I had zero maven experience before) from Starting with Lift. It successfully downloads needed dependencies and everything works fine, however it does not download sources - I'd like to see how lift works from inside.
Looks like it downloads dependencies from here and there are compiled .jar files as well as sources - there are lift-mapper-1.0.jar and lift-mapper-1.0-sources.jar, but only lift-mapper-1.0.jar is downloaded to my local repository. I could download sources manually, but there are more than just few folders there. So, is there a way to tell it to Maven to download dependencies with sources?
The maven-dependency-plugin has a sources goal that will obtain the sources for all dependencies that are available. Simply run mvn dependency:sources to obtain the sources.
If you are using Eclipse, the m2eclipse plugin handles source resolution and attachment for you. You can set it to automatically obtain sources in the Maven preferences. Window > Preferences...->Maven, then enable Download Artifact Sources.
You can also manually invoke "Download Sources" action from the Maven popup menu on any jars (including those that are not managed with Maven). Then plugin will use Maven repository indexes to lookup the corresponding Maven artifact and download its sources.