github project not launching as web app inside eclipse - eclipse

I have eclipse mars installed with the egit plugin. It successfully downloads projects from github, but how do I convert the downloaded github projects into eclipse maven web projects that can successfully launch via Run As ... Run on server in eclipse?
Let's take this two step authentication project on github as an example. How do I get this project to launch from eclipse using Run As.. Run on server?
Here are the steps I took so far:
1.) Right click on white background of eclipse Project Explorer.
2.) Choose Import > Import ...
3.) Select Git > Projects from git from the resulting dialog box
Click Next
4.) Select Clone URI then click next again
5.) Enter the following in the URI field: https://github.com/kyleboon/two-step-authentication-example
6.) Click Next
7.) Click Next Again
8.) Click Next a Third time
9.) Select Import using the new project wizard. Then click next again.
10.) Select maven project and import
11.) Right click on root of resulting project in eclipse Project Explorer and choose Properties.
12.) Select Project Facets
13.) Enable Project Facets
14.) Select Dynamic Web Module to make it a dynamic web project. Click OK.
15.) Right click on project root in eclipse Project Explorer. Select Maven download sources, then Maven update project.
16.) Right click on project root in eclipse and choose Run As...Run on server
The result is that tomcat gives a 404 error when it launches the following url: http://localhost:8080/two-step-authentication-example/
So what steps do I do instead in order to successfully launch this specific github project in eclipse using Run As...Run on Server? This question is general for all github web projects, but we are using this specific project as a case study to test a method that will be repeatable for other github projects.

Related

Setup Minecraft Forge to create mod in eclipse

I'm trying to make a mod in minecraft (1.12.x) in eclipse, but i'm having a lot of problems with it. Many I managed to solve them but this problem not:
Unresolved dependency: net.minecraftforge:forge:1.12.2-14.23.5.2859_mapped_snapshot_20171013-1.12
The error is with build.gradle in line 0. I didn't change anything inside the file path.
Anyone can help me?
Assuming you have git installed:
Clone the Minecraft Forge Github repository
git clone https://github.com/MinecraftForge/MinecraftForge.git
Import project into eclipse
In eclipse, go to File --> Import.
In the Import wizard, select "Existing Projects into Workspace" and click Next.
In the "Select root directory" field, browse to the directory where you cloned the Minecraft Forge repository.
Eclipse should automatically detect the Minecraft Forge project. If it does not, you can manually select it by clicking "Browse" and navigating to the "build" directory within the Minecraft Forge repository.
Click "Finish" to import the project into Eclipse.
Setting up minecraft
Right-click on the Minecraft Forge project in the Package Explorer and select "Properties".
In the Properties window, go to "Java Build Path" and click on the "Libraries" tab.
Click on the "Add External JARs" button and navigate to the "lib" directory within the Minecraft Forge repository.
Select all of the JAR files in the "lib" directory and click "Open".
Click "OK" to close the Properties window.
Running Minecraft
Right-click on the Minecraft Forge project in the Package Explorer and select "Run As --> Java Application".
Eclipse will build and run the Minecraft Forge project.
For this guide, I am assuming that you have everything like JDKs configured correctly.

Importing project from a local git repository into the Eclipse Project Explorer not working

I cloned the following project from GitHub to the git view in eclipse:
https://github.com/nfrankel/twaattin
I want to have the project in my Project Explorer so I can work on it and run it (for testing purposes).
To this end, I went to the Project Explorer and did the following:
I clicked on "File"
I clicked on "Import"
I clicked on "Git" -> "Projects from Git"
I clicked on "Existing lock repository" -> "twaattin"
I chose "Import using the New Project wizard"
I clicked on "Finish"
Then the following window popped up:
I chose "Vaadin 8 Project" and clicked "Next"
The following was displayed:
I chose the first option and clicked "Next"
On the next page I changed the Artifact id to "Twaattin" and clicked "Finish"
The structure of the project I wanted to import is the following:
But this was not imported to the Project Explorer. What I got instead was the following:
So I tried an alternative way ...
I repeated steps 1 to 4 from above but then in step 5 I chose "Import as general project".
After I clicked "Finish", the project became visible in the Project Explorer with its correct structure and I thought everything was fine.
However, now I got the following problem:
when I go to the Servers tab and right-click on my tomcat server and then choose "add and remove" from the menu, the imported project is not addable to the server so can't run it !!
The only projects that I could add to the tomcat server are two old projects I did not import from git but created within the project explorer.
Here's a screenshot:
As you can see the imported project (whose name is "Twaattin") is not amor the addable projects.
So my question is this:
How can I import a project from a local git repository into the Eclipse Project Explorer in a way that it can also be added to the tomcat server ?

Associating a Project to Sonar in Eclipse

I have Eclipse Indigo 3.7 base with MyEclipse 10 Java enterprise development plug-in:
I have installed Sonar plug-in for eclipse.
Installed Sonar server and running it locally from localhost (localhost:9000)
Tested the Server connection in Eclipse from
Windows>Preferences>Sonar>Servers. Connection is successful.
For my Project, ran the Maven goal for sonar (sonar:sonar). Build is
successful. I am able to browse the results in localhost. (localhost:9000)
My issue is with Associating the project to Sonar.
When i right click on my project, Configure > Associate with Sonar, I get a screen where nothing happens.
Basically the screen has 2 fields,Project and Sonar Project.
The Project field contains the name of my Project and Sonar Project field lists this message - "click here to start searching for a remote Sonar project"
I click on that field and enter my groupid:artifactid but nothing
happens.
I also tried entering the Project Name listed in Sonar dashboard
but that also does not help.
When i right click on my project, In the context menu i am unable to see 'Sonar' option.
Help me associate my project to Sonar in eclipse. Please let me know what i am missing.
Thanks in advance.
I had the same issue with my Liferay project in Eclipse (liferay-plugins-sdk.6.2.0) and here is how I got it working:
Install the eclipse plugin, and test server connection
Install the Sonar server and start it (for example on yourhost:9000)
Go to yourhost:9000 and login (admin/admin unless you changed it)
Go to Settings -> System -> Provisioning
Create new project (+Create in the top right corner)
I've used key=Liferay6.2 and name=liferay-plugins-sdk-6.2.0
After the above steps I went back to my eclipse project and in Configure > Associate with Sonar I was able to search/find the liferay project.
When using Sonar Eclipse, you can associate Eclipse projects only to the corresponding Sonar modules (unless you are working on a single-module project, which is pretty rare in fact).
This means that you can't associate the root project (which is logical as by definition, a root project has no sources in Sonar). You have to right-click on all the imported Maven modules, and associate them all in a single run.
Go to your project folder in eclipse workspace from the terminal and run following command:
mvn sonar:sonar
This command will create your sonar project. Try associating the project again. Make sure you enter the name associated with your project from your
pom file. (Clear the text field)
BEST ANSWER AFTER SO MUCH ANALYSIS(I have faced the same problem)
Forget to add to associate with SonarQube first
If you want to add sonar group id create sonar-project.properties
Just add below code
# Required metadata
sonar.projectKey=javapractice
sonar.projectName=javapractice
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
download sonnar-runner from github.
download sonar example from github
download sonar
run sonar as per your operating system from command prompt
go to sonar example path like c:/sonar example/java/.. /.. *.properties path (beside src)
run sonnar-runner c:/.... / sonnar-runner.bat -e
go to browser http://localhost:9000 after that (login:admin/admin)
your project is displayed in the browser.
Choose Maven on the project and then choose Select Maven Profiles and then choose with-sonar in Eclipse. This will enable the Sonar functionality on projects. Now you will see the Sonar option when you right click on projects.

How to run an eclipse m2e webapp project on a local server?

I'm trying to create a simple webapp as a maven project with m2e to help me manage dependencies, but I'm must be missing something, because I'm not able to run the project from eclipse.
To put a bit more context, here is what I do:
First, I choose to create a "Maven project"
Then, I select the "maven-webapp-archetype"
Finally, I fill the basic project information form of the next step and finalize project creation. Everything looks fine at this point.
The problem is that when I try to run the project, I don't find anything suitable to run the project on a local server:
Also, from the "Add and remove..." context menu entry of the local server, my project doesn't appear in the list of web projects.
Did I miss a step in the setup, or is there an other more suitable way to start the project?
You should install the m2e-wtp connector.
You can install this from: Window, Preferences, Maven, Discovery, click Open Catalog and search for wtp. Check the box next to m2e-wtp, and click Finish.
Once the installation process has completed, allow it to restart Eclipse. After that, you may need to right click on the project, choose Maven and Update project.

Can't run my Struts 2 Maven Project from Eclipse

I've got my Struts 2 project working fine. I built it via the command line and everything went well. My final step involved deploying to tomcat, again via command line:
mvn tomcat:run
In the folder with the pom file. That worked - i could hit the project via the browser. But when I imported it into Eclipse;
File -> Import -> Existing Maven Projects -> MyProject
the project imported but can't be run from Eclipse. The option under Run As -> Run on Server isn't there.
How do I get that option to appear?
Figured it out. Right click on the project folder, scroll down to properties(or press the Alt+Enter shortcut on Windows) and select Project facets.
From there ensure that "Dynamic Web Module" is clicked and select "Apply." Now you should beable to run the project on the server.