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.
Related
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
I'm having trouble understanding how to get repositories in the "Indexed Maven Repositories" list of the IntelliJ IDEA.
In one my project I have two repos in this list: one local and one (main) remote (see attached screenshot below). And in other project (created using AppFuse template) I have only one (local) repo in list.
I'm tried to add the repos in pom.xml file and in settings.xml file, but the repos did not appear in this "magic" list.
And this means:
I can't see artifactId and versions of artifacts in dropdownlist (Ctrl+SPACE)
IDEA can't find the necessary artifacts (or his versions). It is looking only in my local repo
Version of IntelliJ IDEA: 11.0
Version of Maven: 2.2.1
This list is updated automatically from the repositories specified in your pom files (or inherited from parent project's pom and settings.xml).
If you open a project that has some additional repositories specified, you'll see them in this list and will be able to update the indices.
You can manage these settings by editing your settings.xml file of the project
Open the Project file list (Ctrl-1)
Find your main parent pom.xml file
Right click on it Choose Maven -> Open 'settings.xml'
As you can see it is a local copy of settings.xml file for your project.
There is you can add/remove active repositories of the project.
Look at the settings->repositories manual for details.
I had a related issue where I changed the repository in my settings.xml but the Indexed Maven Repositories list was still pointing to the old one. In order to get the maven build to look at the new one I had to run mvn idea:idea on the project
Hi I'm reading up on Ivy for the first time and had a few quick questions:
Need confirmation: the IvyDE plugin is used to configure just the ivyconf.xml file for all workspace projects, correct?
Where does this ivyconf.xml live? I'm running Windows 7 and can't find this hidden .ivy directory anywhere!
Where do you usually place a project's ivy.xml and other xml config files?
Thanks for any nudges in the right direction!
IvyDE allow you to resolve dependencies per project. You could use separate ivyconf.xml in different projects.
You could place ivyconf.xml (or ivysettings.xml) where you want. You could use one per project (as I do) or one for all projects (as I did before).
Usually I put ivy.xml beside Ant's build.xml in the root of my project. But ivysettings.xml I put in project/etc/ivysettings/ directory.
My team uses a separate build project in Eclipse that stores the ivysettings.xml file. The IvyDE plugin provides the Ivy dependency container that the Java projects can use. IvyDE can optionally allow inter-project dependency resolution, but this is off by default.
I'd suggest changing the order of classpath entries in the Ivy Classpath configuration to lexical, otherwise it shows dependencies in the order of the ivy.xml file.
Each project should have their own ivy.xml file - we also follow the same pattern as Alexey uses of using the project's top-level directory.
I've never used an ivyconf.xml file - a quick google suggests this is an alternative (older, deprecated?) name for the ivysettings.xml file.
You will need to write your own ivysettings.xml file to tell IvyDE where your repositories are and which resolvers to use. Leave a comment if you're interested in an example ivysettings.xml file.
Which repositories are you using? Maven Central? Setting up your own repository with Nexus, Artifactory or just using the file system?
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/
Hi i am studying Spring In Action 2.0 and i am new to maven.
I am walking through the chapters and codes but i i got following error when i imported project through pom.xml on the pom editor in eclipse.
6/21/09 3:19:42 AM CDT: Missing
indirectly referenced artifact
incubator-activemq:activeio-core:jar:3.0-beta3:compile
6/21/09 3:19:42 AM CDT: Missing
indirectly referenced artifact
incubator-activemq:activemq-core:jar:4.0:compile
I downloaded the jar file and added to the library. still it does not work.
I am stuck what to do next? Can anyone help me with this?
Thanks in advance.
The referenced jars aren't available on the Maven2 central repository, so unless you have an additional repository declaration in your POM or an active profile in your settings, Maven will not know where to obtain the artifacts from.
There are a few public repositories like here and here hosting these artifacts.
To use these repositories you could add the relevant repository declaration to your POM or settings. See here for an example configuration.
Alternatively if you don't trust the repositories you could manually download the jars and put them into your local Maven repository, though you'd need to be careful to replicate the structure Maven expects, and you may well encounter the same problem for different jars.
Another alternative is to use a Maven repository manager like Nexus or Artifactory, to manage Maven's interactions with external repositories, though that is almost certainly too much information if you're just starting out.
For general help/information on Maven, check out the Maven book.