How to run the downloaded project through eclipse - java

I am referring "http://krams915.blogspot.in/2011/01/spring-mvc-3-hibernate-annotations.html" blog and at end of the blog there is source code in zip folder i have downloaded but i dont know how to run in Eclipse,
at the last on blog they have mention
You can run the project directly using an embedded server via Maven.
For Tomcat: mvn tomcat:run
For Jetty: mvn jetty:run
I dont know how use this steps.please help me how to run this project,
I am using tomcat as my server,
Thanks,

Basically you need to do two things:
Install maven plugin in eclipse.
Add a tomcat server instance in eclipse.
This link should guide you to achieve that:
http://www.mulesoft.com/tomcat-maven

Install Maven
go through command line to your project folder
call mvn tomcat:run or mvn jetty:run

1.Install Maven
2.set system enivorment
3.go through command line to your project folder(where the pom.xml is)
4.call mvn tomcat:run or mvn jetty:run

Download Spring Source Tool suite which comes along with maven. It maked things little easier for you. You can directly run maven projects from the IDE itself.

Related

Want to build project with commandline mvn but have to use Maven update in eclipse first

I'm working with multiple projects in Eclipse. because I want to automate the building I want to script the building process.
Unfortunately I cannot do the same actions on the commandline as in Eclipse.
So a common problem is that when a new function from a referenced project is used, I cannot build the project on the commandline with mvn. I use the command:
mvn clean install -U
But this command will give a build failure until I do a Eclipse Maven Update from the eclipse GUI. After that I can build the project again.
I also tried all the other commands I came across Stackoverflow:
mvn eclipse:eclipse
mvn dependency:resolve
So I just want to that Maven Update command in eclipse from the commandline so I can build from the commandline. If anyone could tell me what I'm doing wrong that would be awesome.
Thx in advance
Update for more clarification:
The project structure is:
Rest-service, Framework-service, Framework-model
Framework-model is referenced in the pom file by Framework-service and Framework-service is referenced by Rest-service. The other projects are not relevant to the problem.
When a function is added to Framework-model and used in Rest-service it gives an compilation error in eclipse and when I build with mvn clean install -U, although Maven install in eclipse is succesful but I think it is still using the old compiled code. After a Maven Update command in eclipse the compilation error is gone. And mvn clean install -U from the commandline also works.
How could I do a Maven Update command in the commandline? If mvn clean install -U should also do a Maven Update command, what settings should I check?
Another update: So this weekend I tried different things and running mvn compile before the mvn clean install -U command gives a different output. And finds the new function. But as I read maven, I thought install should also do the previous steps. How is this possible?
Eclipse's Maven plugin uses the maven version configured in Preferences/Maven/User settings. If you have a different version of maven in your Eclipse's settings than the one on your PATH variable, you could have different outputs. Maybe try and check that.

How do I build this java project with maven?

I honestly don't know anything about java, I'm just trying to build the latest version of this project to try and work around bugs in the version that is packaged by my OS. The project in question:
https://sourceforge.net/projects/tuxguitar/
I tried running mvn compile, mvn clean package, and mvn clean install but no jar file was produced in the source tree. The readme has no instructions for building. Any help would be greatly appreciated!
Thanks!
To produce jar you need at least package phase, you can get there by doing:
mvn clean package
(clean is to remove stale data, it is a good practice to use it always with maven) and you jar will be in target directory.
mvn complite just complite the project and no package.
answer : mvn clean package.this will clean,complite and package the project,after finished, you can found the package(jar or war) into the $PROJECT_HOME/target/ folder.
I usually run mvn clean install - which in addition will add the built jar into your local maven artifact repository.

How to stop eclipse to redownload the plugin from repository for a maven project

I am importing an existing project into my eclipse workspace. I am using Maven 2.2.0, and Eclipse Juno. I could build project successfully using mvn command prompt.
But unable to import the project as eclipse could not build the project.Eclipse is trying to again download from repository. What If we stop eclipse to download the resources again from repository.
I thought I would add Windows--->Preferences-->Maven--Archetype--Add local catalog
I understood that we have ~/.m2/archetype-catalog.xml catalogu file. But to my surprise I cannot find it.
Please suggest me if I am proceeding with correct way or not.
If its correct way, how do I set local archetype.
Please share your thoughts.
Thanks In Advance.
You need to install the mvn plugin and import the mvn project as such. Alternatively, you can eclipsify the mvn project using the goal eclipse:eclipse (with the mvn command line).
In mvn itself you could set the pluginRepo to updatePolicy NEVER temporarily, if you still have issues with Eclipse. I think Eclipse uses the same settings for importing mvn projects.
http://maven.apache.org/settings.html
I personally never was happy with Eclipse's mvn integration. Have you tried IntelliJ?

Building a project with maven

I am trying to execute a sample application from here: http://www.ixtendo.com/secure-your-jsf-application-with-jaas/#comment-3792. The author says:
To build the project, you have to install Maven and call mvn clean package.
I have installed Maven in my Ubuntu 12.04. But I am new to Maven and don't know how to build the project with it. Could someone please explain in detail how to build the project with Maven?
The command mvn clean will work only if you are executing the command from the context of the application where pom.xml is located.
here is a quick tutorial for Maven.

Maven deployment

mvn clean deploy -P PROD
What does this code do?
mvn jetty:run
I have a war file, do i need to run this deploy code too... i am bit confused.
I'd advise you to read the Deploy plugin documentation, ditto for the Jetty one.
From what I can see, mvn clean deploy cleans your project (suppresses compiled files), and then compiles and deploy it. mvn jetty:run launches the jetty server.
If you're completely new to Maven, it's a build system, to help you manage your dependencies and your application lifecycle. You can read more about it on the Maven site.
clean deploy
I suggest you read up on the Maven Build Lifecycle to get full details on these.
-P PROD
This runs the build under the PROD profile; presumably it is your production build.

Categories

Resources