I don't get importing Maven Project options - java

I am new to Java
I have been trying to compile my open source application
with provided steps
Import Project from Maven
1. Start IntelliJ IDEa.
2. In the "Quick Start" menu, select "Import Project".
This will open a "Select File or Directory to Import" dialog.
3. Browse to your local cTakes repository root directory and select the pom.xml file.
4. Click "Ok".
This will open an "Import Project from Maven" dialog.
5. Make sure the "Search for projects recursively" box is selected, just in case any cTakes modules are not in the pom.
6. Make sure that "Create IntelliJ IDEa modules for aggregator projects" is not selected.
If you plan to add new module, 'disable' a present cTakes module or make other changes to the main pom.xml, check the "Import Maven projects automatically" box.
See also: http://www.jetbrains.com/idea/webhelp/maven-importing.html
7. Make sure that "Create module rgoups for multi-module Maven projects" is not selected.
8. Make sure that "Keep source and test folders on reimport is selected.
9. Make sure that "Exclude build directory (%PROJECT_ROOT%/target)" is selected.
10. Make sure that "Use Maven output directories" is selected.
11. Make sure that the "Generated sources folders" option "Detect automatically" is selected.
12. For the "Phase to be used for folders update" the default option "process-resources" should be fine.
13. For the "Automatically download" options, you may select what you like, but be wary that if broken code has been checked in you may need to revert manually.
14. The default "Dependency types" are fine.
15. Click "Environment settings...".
This will open a dialog that can be used to set options about the Maven environment.
16. The default maven environment settings should be fine. If $M2_HOME is not set in your environment you may select a "Maven home directory", but it is better to set $M2_HOME in your environment.
17. Click "Next".
This will inspect the cTakes Maven settings and search for profiles. It should display a dialog with the possible cTakes profiles.
If you plan to run the UIMA CVD or CPE then select the appropriate profile. Neither is necessary
18. Click "Next".
This will open an "Import" dialog with the current version of cTakes displayed.
19. Click "Next".
This will open a dialog allowing you to select a Java SDK version.
20. Click the "+" button in the top left.
This will display a drop-down box with options for an SDK.
21. Select "JDK".
This will open a dialog to select a Java JDK directory.
22. Navigate to a directory with a JDK version 1.8 or later and click "Ok".
This will display a listing of the file paths associated with the selected JDK.
23. Click "Next".
24. Click "Ok/Next"
The project will load. This may take a while.
25. Important: If you are asked about adding any .iml files to svn, click "No".
26. You should now see the full cTakes project structure in IntelliJ.
I get everything up to step 4
but step 5 does not exist in my case
I mean in step 5
5. Make sure the "Search for projects recursively" box is selected, just in case any cTakes modules are not in the pom.
There are no options I get, it immediately takes me to the IntelliJ project
I get this screen
after I ckick finish , it takes me to this
Am I using older version? or doing something wrong?
How to get the Maven options as the instructions suggested?

It appears that you're in a unique position where the import and the recursive scanning of projects has Just Worked™ for your use case.
Given that IntelliJ IDEA 2019.3 came out at the end of November 2019 and I'm not reasonably convinced that those instructions were written or revised between the end of November and now, it could easily be the case that the instructions you've seen are out of date.
The big thing to be sure of is that your subprojects also build. On the right-hand side there, you have a list of Maven projects. Any one of those should be subprojects. Be sure that any Maven build command (e.g. mvn clean install) executes in the context of that subproject.

Related

installing packages locally for a new project in Java

I have downloaded a simple project from a Git repository and opened it in Intellij. A couple of the import statements are highlighted in red, stating "Cannot resolve symbol." The packages that cannot be resolved are: zaxxer, springframework.
Normally in Perl or Python I would fire up a dependency manager like CPAN and simply install them, but my understanding is that there isn't really any such thing in Java and that dependencies are resolved sort of on a project-by-project basis.
I have Maven 3 installed, and my project has a pom.xml file, for what it's worth. What should I do now?
If you have opened the project in IntelliJ you can right click the module and choose "Add framework support". Choose Maven there, if it isn't there then it is already enabled.
Then, simply open your pom file. When indexed there should appear an dialog in the lower right corner asking you if you want to auto import changes or just import them manually. Click on one of them and the dependencies will be added.
If you can't see this notification it may have already been shown, then simply press on the "Event log" in the bottom right corner and the notification should be displayed (with eventual other info).
Edit from OP: Solution was: 1) Turn on the view in View > Tool Windows > Maven Projects. There was no Maven project here, so I added it (selected the pom.xml). 2) As described in an answer at Failed to Read Artifact Descriptor: IntelliJ "In Intellij, go to File -> Settings -> Build, Execution, Deployments -> Maven Check the box, ‘Always update snapshots’
It's a little weird that "always update snapshots" isn't turned on by default for IntelliJ, but this got things working.

Run as cucumber feature not showing in eclipse

I am new to automation. Im facing this problem while running cucumber feature. It doesnt show run as Cucumber feature option at all
Screen shot of Run as options in eclipse
As, when you open a feature file in Eclipse and right-click, then you do not find an option 'Run As->Cucumber Feature', it appears that your Eclipse do not have the required Cucumber Eclipse Plug-in. You can install this plug-in using following steps:
Launch Eclipse and navigate to 'Help->Install New Software'.
Click on 'Add' button
Enter any name e.g. 'Cucumber' and type 'http://cucumber.github.com/cucumber-eclipse/update-site' as location.
Click on OK.
'Cucumber Eclipse Plugin' option will appear in the available software list.
Select the check box against it and click on 'Next' button.
Read the terms of license agreement and click on 'I accept the terms of the license agreement” if you agree with the license terms.
Click on 'Finish' button.
Let it install, it will take few seconds to complete.
After successful installation of this plug-in, if you open any feature file (i.e. file with .feature extension) and right-click, you should see 'Run As->Cucumber Feature' option.
Update 1
In Eclipse, go to 'Windows->Preferences->Run/Debug/Launching/Launch Configuration' and uncheck 'Cucumber Feature' checkbox if it is checked. Refer to below screen shot for more details:
If it is a maven project make sure you have included it as a dependency.
If you are running it as automation it would be a good idea to set it up as a maven project.
It's hard from your brief description, but if you are seeing the 'Run as Cucumber Feature' but it isn't doing anything, I had to open up the feature, right click on the white space in it, and then run as Cucumber Feature there. For some reason that worked for me.

POM.XML add dependency search not Working?

I am using Eclipse Mars 4.5.2 which by default contains Maven.
I created a new Maven project and when I try to add dependencies through pom.xml, by clicking on the dependency tab and adding it. After I entered "spring framework" in search bar, it is not showing any result (in windows 10).
How to fix this issue?
Just manually edit the pom.xml after creation of the project and e.g. search Spring on MavenCentral (e.g. here: http://search.maven.org/#search%7Cga%7C1%7CSpring).
Maybe not ideal on the long run but that should allow you to continue working on your project most quickly.
For some reason, Eclipse did not fetch the index from MavenCentral. Go to the "Maven repositories" view and click on "central" in "Global Repositories". You probably do not see elements in it. Make a right click and check whether the index is enabled. If it is, try "update". An update of central may take 30 minutes or more.
If none of this works (which is quite possible), throw away your local repository (in the .m2 folder in your home directory) and retry everything. Local repositories are sometimes broken.
In eclipse go to Window -> Preferences -> Maven
Then go to Window > Show View > Other > Maven > Maven Repositories
Click on "Full Index Enabled" and then click on "Rebuild index" as shown below

How to change java source in intellij

I have an intelliJ project which was working just fine untill I accidentally created a maven pom for it by right clicking on the project folder. I'm not sure exactly what the option I clicked was called (it wasn't the one I was trying to click). ctrl-z did nothing, so I deleted the pom. Now I'm stuck with a project that will only compile with java 1.5.
I tried adding the pom again with proprties set as shown in this question. I also tried going into Project settings where I can clearly see the Project language level set to SDK default (8).
Go to File -> Project Structure -> Project and choose your desired language version in "Project Language Level" dropdown menu.

How to configure/Run an Ant Java project in Eclipse

I have a working java project (in ubuntu 12.04LTS, configured and compiled using ant). Is there a way I can configure and run it in Eclipse? Every time I try to load it in eclipse it gives a bunch of errors because of packages not being where its expecting I guess. Also, it will help if you could tell whats build path. I'm using Eclipse Java EE IDE Kepler Release.
My project structure looks like this:
project
build.xml
build.properties
build.common
projFolder - proj code, 3rd party lib/bin/src,
commons - proj code, ui code, 3rd party lib and binaries
dist - has a bunch of scripts and jars and may be some binaries
And how I got my project in Eclipse (this is probably not the most efficient way to have the project running in Eclipse, not sure)
I did new->java project then enter project name, unchecked 'use default location' and provided the location of my project so it imported my project in eclipse. then in my classes i have all the errors (red cross at the display) and it says imports cannot be resolved, objects can't be resolved to a type and such.
import com.psid.codedata.projects.TProjectDRD;
import com.psid.codedata.projects.TProjectsDRD;
error on above imports:
The import cannot be resolved
It probably needs you to add all your source folders to the build path:
Right-click on your project and select Properties,
Along the left-hand side click "Java Build Path",
Click the "Source" tab if it isn't already selected,
Click the "Add Folder..." button on the right-hand side,
Select whatever your source folders are in projFolder and commons,
Click the "Libraries" tab,
Click the "Add JARs..." button on the right-hand side,
Select whatever your libraries are in projFolder, commons and dist,
Click the "OK" button.
Note that "New -> Java project" is for creating a brand new, empty project. Since you want to create an Eclipse project from an existing project with an Ant script, you should select the appropriate selection under the "Ant" subsection in the New Project dialog. See this answer to a related SO question for details.
add this line to nbproject/project.properties:
j2ee.server.home=http://localhost

Categories

Resources