| View previous topic :: View next topic |
| Author |
Message |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Thu Sep 08, 2011 3:28 am Post subject: startup the maven project takes too long time |
|
|
I have a maven managed web application.In netbeans ,when I run the web application, there are always packaging the war pack step ,and this setp is time consuming.
I want ,in development mode, only compile the changed class,and copy the new files into the unpacked directory and deply this directory,how to do it? |
|
| Back to top |
|
 |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Thu Sep 08, 2011 7:54 pm Post subject: |
|
|
| In eclipse ,the maven plugin don't package the war when startup web application server,how it implements this?is there anybody know? thanks |
|
| Back to top |
|
 |
mdeggers
Joined: 28 Jan 2009 Posts: 208
|
Posted: Thu Sep 08, 2011 8:46 pm Post subject: |
|
|
This seems to work fairly well:
http://mrhaki.blogspot.com/2009/02/use-jetty-to-run-maven-web-applications.html
I've used it to run a simple Struts 2 application. I've not tried the
debugging mode yet, but I like the idea of adding a separate action to
start up Jetty in debug mode.
Here is the Maven plugin page:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
Here's how I do it in NetBeans 6.9.1.
1. Modify the pom.xml
Under build->plugins, add a new plugin node:
| Code: | <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8006</stopPort>
<stopKey>stop</stopKey>
</configuration>
</plugin>
|
By the way, I've tried the new version of the plugin
(jetty-maven-plugin), and I could not get it to pick up JSP pages. I suspect
there are configuration parameters I could play with, but I didn't explore.
2. Next add two custom actions under Project->Properties->Actions
2A. Create a startJetty custom action with Execute Goals: set to
jetty:run
Add any other arguments (like a log4j logging directory, and skip tests) in
the Properties window.
2B. Create a stopJetty custom action with Execute Goals: set to
jetty:stop
Now when you select Project->Custom->jettyStart, Jetty should start and
run your web application. Every 10 seconds Jetty will scan for changes
and that should be reflected in your web application (and browser).
It looks like you can also create a jettyDebug custom action by adding the
following properties to a jetty:run Execute Goals:
jpda.listen=maven
netbeans.deploy.debugmode=true
Here is the link for the above information:
https://cwiki.apache.org/WICKET/maven-jetty-plugin.html#MavenJettyplugin-ConfigurecustomRunandDebugactions
I've not experimented with this.
. . . . just my two cents.
/mde/ |
|
| Back to top |
|
 |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Fri Sep 09, 2011 3:01 am Post subject: |
|
|
| so good ,thanks mdeggers. |
|
| Back to top |
|
 |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Fri Sep 09, 2011 3:43 am Post subject: |
|
|
oh,there are another problem.where can I set the maven_opts in netbeas?
when run the server,I got the outofmemory exception. |
|
| Back to top |
|
 |
mdeggers
Joined: 28 Jan 2009 Posts: 208
|
Posted: Fri Sep 09, 2011 5:36 am Post subject: |
|
|
From what I've read online, the bundled Maven should read the
MAVEN_OPTS environment variable.
Here's a bug filed where setting debug while running Maven overwrote
the system MAVEN_OPTS (along with a work-around).
This appears to be fixed in 7.0, so all you have to do is specify MAVEN_OPTS
in your environment.
http://netbeans.org/bugzilla/show_bug.cgi?id=166874
. . . . just my two cents.
/mde/ |
|
| Back to top |
|
 |
tony_Mresangelo
Joined: 01 Sep 2009 Posts: 37 Location: Italy
|
Posted: Fri Sep 09, 2011 6:34 am Post subject: for what purpose maven can be used inside netbeans ? |
|
|
Hi,
I see that many netbeans users, use maven too.
This pushed me to know more about maven, and I learned that maven helps to manage projects..
After that I knew this, I would ask what can be the reason to use maven inside netbeans that already menage projects?
After that I realized this, I would ask what can be the reason to use Maven inside NetBeans, since NetBeans it already serves to manage projects?
Thank you
Regards
Angelo Moreschini |
|
| Back to top |
|
 |
mdeggers
Joined: 28 Jan 2009 Posts: 208
|
Posted: Fri Sep 09, 2011 7:46 am Post subject: |
|
|
Maven does two things that NetBeans does not do by itself.
Manages dependencies
This is the big one. If you have a complex piece of software that relies on
a lot of third party libraries, Maven can help you easily manage the
dependencies (and the libraries those libraries depend on) without you
cluttering up your version control system and without you having to think
too hard about it.
Ivy is another tool that does this (Ant-based). NetBeans has a plugin for
Ivy.
Consistent build environment
If you have a bunch of developers running different systems (and possibly
different IDEs), then a consistent build environment lets everyone build
the software the same way. You also have a good idea as to what went
into the software.
NetBeans by itself can sort of do this if everyone uses the same version
of NetBeans with the same plugins, and the same JDK . . . blah blah blah.
Maven enforces this.
Plus, it's easy to automate testing, create project web sites, and do
agile development with NetBeans / Maven / svn or hg.
. . . . just my two cents.
/mde/ |
|
| Back to top |
|
 |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Fri Sep 09, 2011 11:24 am Post subject: |
|
|
| is Maven Jetty Plugin support hot deploying?when I modify a class,and apply change In netbeans ,the server will restart,how to configure to overcome this ? |
|
| Back to top |
|
 |
mdeggers
Joined: 28 Jan 2009 Posts: 208
|
Posted: Fri Sep 09, 2011 7:20 pm Post subject: |
|
|
This is really a Maven Jetty plugin question. However, I've found that
the following works.
1. Comment out the <scanIntervalSeconds> element
This is what causes the Jetty plugin to scan directories and reload the
web application. It does not restart the Jetty server.
2. Add <reload>manual</reload> to the Jetty plugin configuration
See the Jetty plugin web page for those details
3. Start the Jetty server from Maven as normal
4. To reload your web application, just hit the Enter key in the output
window.
Now instead of the Maven plugin scanning every N seconds (my setup was
for 10 seconds), you'll have to press enter in the Output window.
Personally, if I'm going through the effort of running a Maven Jetty plugin,
I'm going to use the scanning feature so that my changes are rapidly
reflected in the web application.
. . . . just my two cents.
/mde/ |
|
| Back to top |
|
 |
difficult
Joined: 04 Jan 2009 Posts: 52
|
Posted: Sun Sep 11, 2011 8:24 pm Post subject: |
|
|
to mdeggers:
I do like your advision,and when modify the class,the server will not restart indeed,but there is a other question again,I can't save the static modified files ,such as the html,js file,but the jsp can be saved.Only when I stop the server,there sataic files can be save again. why ? |
|
| Back to top |
|
 |
mdeggers
Joined: 28 Jan 2009 Posts: 208
|
Posted: Mon Sep 12, 2011 5:27 am Post subject: |
|
|
Yep, one of the blogs I read noticed the same thing.
There was a hack to get it to work, but I can't seem to find it right now.
The later version of the plugin (jetty-maven-plugin) has some additional
configuration parameters that should solve the problem.
See the following reference:
http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin
Unfortunately I was not successful in getting this to run with a quick test.
Maybe I'll spend some time with it this week and see if I can't get the
agile testing to work with this plugin.
Give it a shot, since <scanTargets> and <scanTargetPatterns> seem
to be exactly what you're looking for.
. . . . just my two cents.
/mde/ |
|
| Back to top |
|
 |
tony_Mresangelo
Joined: 01 Sep 2009 Posts: 37 Location: Italy
|
Posted: Mon Sep 12, 2011 10:44 am Post subject: what benefit comes from useing maven with NetBeans ? |
|
|
Hi,
I would like to ask somebody who is using maven together with NetBeans what benefit he gets from using both together.
I ask it because I know that maven serves to manege projects; the same that already does Netbeans.
I ask the question from somebody who uses both to let me know the reason
thank you
regards
Angelo Moreschini |
|
| Back to top |
|
 |
tony_Mresangelo
Joined: 01 Sep 2009 Posts: 37 Location: Italy
|
Posted: Tue Sep 13, 2011 3:33 pm Post subject: what benefit comes from useing maven with NetBeans ? |
|
|
Maven is not an IDE as NetBeans is. Maven lakes total in EDITING source code, refactoring, gui-design, coding, etc. in the large.
Maven can however create the base structure of many projects as i.e. NetBeans can, but it does it based on CONVENTIONS maven like.
Maven is strong in doing complex system builds
Maven is very strong in managing all kind of artifacts your system depends up on
Maven can call ANT and ANT can call maven
Maven can invoke code generators
Maven runs your regression test suits and unit test suits on each build
You use maven to build maven
BUT
Given you like to add your own bits to a larger open source project called AXIS2
You need an IDE to edit and investigate existing code and navigate among that, a thing maven cannot do
You open a maven project and you build it in your IDE, but actually maven controls the build
You need to integrate your code with the existing project, need to include it using maven, as after all, everyone, worldwide, expects that your bits added will clean and install as well on their own systems without any IDE as you might have
i.e. You checkout the sources of axis2 from a subversion repository and you can do a
$ mvn –Drelease –U clean install
and build axis2, without any IDE
But how do you inspect the code or enhance it with your own bits and bytes and build it consistently or allow others to rebuild it thereafter you committed it.
If you do it the first time, maven will download quite some *.jar's ,its plugings it's own tools into the local repository.
Also all artifact maven builds are stored at the same local repository. So the greatest benefit is
Maven will all time automatic download dependent artifacts from a repository, this most benefitting complex projects
a) It downloads form a central repository (worldwide) into your local repository OR
b) It downloads from a mirror of the worldwide available central repository to your local repository
c) It builds all your artifacts according to CONVENTIONS and your own pre-defined rules (read about maven please)
If you need more to know – please read about maven to see its strengths
So maven goes hand in hand with every good IDE
Josef
======
Hi Josef,
thank you very mutch for your kind answer.
You explained very clearly with all details what I wanted to know. all the best
Angelo
Von: address-removed [mailto:address-removed]
Gesendet: Montag, 12. September 2011 11:54
An: address-removed
Betreff: [nbusers] what benefit comes from useing maven with NetBeans ?
Hi,
I would like to ask somebody who is using maven together with NetBeans what benefit he gets from using both together.
I ask it because I know that maven serves to manege projects; the same that already does Netbeans.
I ask the question from somebody who uses both to let me know the reason
thank you
regards
Angelo Moreschini |
|
| Back to top |
|
 |
Ed Hillmann Posted via mailing list.
|
Posted: Tue Sep 13, 2011 10:35 pm Post subject: what benefit comes from useing maven with NetBeans ? |
|
|
| I agree with the previous answer. |
|
| Back to top |
|
 |
|