On "Select an Archetype" screen, for filter type "webapp"
select "maven-archetype-webapp" under Artifact Id
Enter a group-id and artifact Id and click finish
Delete the project from Eclipse (but not from hard drive)
open command prompt and go to root of new project (where resides pom.xml)
enter: mvn eclipse:eclipse -Dwtpversion=2.0
Import project into eclipse (kepler java EE)
Open Project properties
under Project Facets change java version to match the system (i.e. 1.7)
Add a Tomcat Server to Eclipse
Under Server Locations ensure "use Tomcat installation" is checked
Set Server path to tomcat server e.g. c:\apache-tomcat-7.0.52
Set Deploy path to C:\apps\apache-tomcat-7.0.52\webapps
Open Modules tab and click Add Web Module
Choose the new project and click ok
Expand Servers and Tomcat v7.0 Server
open file tomcat-users.xml
Add to tomcat-users element:
<role rolename="manager-gui"/> <role rolename="admin-gui"/> <user username="admin" password="admin" roles="admin-gui,manager-gui"/>
click Debug - Tomcat v7.0 Server at localhost
Open localhost:8080 in the browser
click Manager App (and enter credentials)
scroll to your new web app and click it to show your site
Deploy to OpenShift
in command prompt in openshift app dir (with .openshift, deployments, src, etc.) enter:
git rm -r src/
in xplorer2, select the src folder of the Eclipse maven project in the left pane and in the right pane have the openshift app dir
click copy to, when prompted allow to merge src.
back in cmd, enter 'git add .' then 'git commit -m "blah"' then git push
Load it in the browser e.g. http://jbossas-<your namespace>.rhcloud.com/<warName>/index.jsp
Now you can modify the eclipse project, e.g. add a main.jsp etc (see http://awgtek.blogspot.com/2014/03/deploy-small-java-app-to-openshift.html) and after each test in local tomcat do another Deploy to OpenShift.
Deploy Struts app to OpenShift? No problem. Set up StrutsExample per http://www.mkyong.com/struts/struts-hello-world-example/
follow same instructions as "Deploy to OpenShift" above, i.e. git delete src and copy src folder from the Struts eclipse tested app. THEN make a change to the pom.xml that exists in the openshift app dir copying over the two dependency elements from StrutsExample for org.apache.struts. git add/commit/push. OpenShift will download the dependencies per the maven pom.xml.
No comments:
Post a Comment