I can easily create a Maven project for programming portlets (for example using archetype). But in order to deploy this project to Liferay, I have to run:
mvn package liferay:deploy
Even if I change just a simple JSP file, I have to redeploy the whole portlet application. Is there a way to speed up this development process?
I don't want to use Ant, because then I would have to deal with dependencies and other stuff. I would really like to use Maven to develop Liferay portlet applications.
I tried JRebel, but because of the packaging to WAR file it's magic doesn't work :(
To re-create this situation:
Create project from maven archetype with artifactId: liferay-portlet-archetype
Add properties to pom.xml: liferay.version, liferay.auto.deploy.dir
Start Liferay
mvn package liferay:deploy -> this will create a WAR file and deploy it to liferay auto deploy directory.
Each time you want to change something, you must do mvn package liferay:deploy
This is time consuming on something bigger than just hello world.
As far as I know this is supposed to be the best practice. But Liferay documentation is sparse on this subject. Is there another way?
Problem solved using combination of STS (SpringSource Tool Suite) and Liferay IDE. With this combination it's not necessary to use Liferay Maven plugin at all. Just simply add Liferay server, deploy Maven app on this server and it all works.
Using this combination with JRebel is IMHO the most effective solution.
Your application can be packaged in WAR for JRebel to work, no problem there. Did you put rebel.xml configuration file into the WAR?
Related
I am new to jenkins so i don't know in depth about it. But in recent days we wanted to change from svn repository to GIT in which we have a java project created in dynamic web project. Now we have to deploy this project in jenkins. But i read that in jenkins only projects created in maven are accepted but not any other. Our project is a huge project and its created using dynamic web project. So if we want to convert to maven project will there be any code changes like many??
What are the jar files or any configuration files needed for the change??
I don't know whether this question is quite suitable to ask or not but we have less time and i am completely new to jenkins.Any suggestions or answers will be valuable to me
You will need to think about how you will run your application in production. Will you run it as a packaged war file in tomcat, jetty or another JEE server or will you run it using an embedded server (embedded tomcat etc) where the server is packaged with your application as an executable jar file.
Once you work that out you should think about how you are going to build the application, Maven, Gradle and Ant + Ivy are your three main options. Jenkins supports all of these options, not just maven. Besides being able to help you build your application in a standardized way, these tools will be able to help you manage your dependencies.
There really is not much configuration required once you know how to use the tools and your dependencies can be removed from your /lib folder (or wherever you are currently storing them) as a result.
So take some time to read up about each one, make your choice and then apply it to your project. It is a worthwhile investment and something you will use over an over again.
Jenkins makes a LOT of things easier if you have a Maven project, but you can specify a free form project where you can specify your own build command. This is not coupled with the git/svn repository.
Experiment with Jenkins. It is rather nice, and can do a lot of things when you learn it better.
I'm switching from Eclipse to IntelliJ Idea and had some, homemade i guess, problems while deploying.
In Eclipse usually my (main-) project contains 4 subprojects:
EAR
EJB
Shared (with JPA Entities, JPA Facet and so on...)
WEB (JSF, REST)
I know that JetBrains way of organizing is another. So i create a new Project and check all desired technologies i need (EJB, Web, CDI for example). When i try to deploy the project there is as cdi ambigious error, because the class is in the EJB artifact and also in the Web artifact. So my stupid way of thinking was, to delete the compile output from the web artifact, but now the files are not accessible in the Web-Project anymore (CNFE while calling).
So please, what is the correct doing if i'm trying to develop a project with EJBs, JPA, Web (JSF, REST). That could not be so hard and i'm going insane ;). Thank you!
Guten Abend,
I think you should allow to build your project from the command line. I use IntelliJ for large projects and I always make sure that I can build the thing from the commandline with a mvn clean install since it is sometimes needed and good not to depend on an IDE. I recommend that you divide your projects into the subprojects that you mention and make a pom.xml for each project and put the source into source control e.g. subversion. Then you will be able to checkout the project from subversion and it will load up neatly in IntelliJ iff you got it all configured right.
So if you haven't already, consider using Maven and Subversion (or some other VCS) for your projects and it will simplify your work.
If you provide more details about specific files and specific error messages we can help you more to move forward, and these were my general recommendations.
My setup in IntelliJ that builds a large project from several subprojects looks like the following.
When done this way, I can rebuild individual subproject without being forced to rebuild the entire thing just because of one small change. And I also can build everything from the commandline using the maven command mvn clean install
I've got a java project that's using Maven in Eclipse, and would like to completely remove the Maven aspect of the project, and set it up as a completely stand alone Dynamic Web Project that doesn't depend on Maven at all, but uses Ant instead.
I assume this will involve:
finding out the libs that are required
creating an ant "build.xml" file
more steps that I'm not sure of ;-)
What's the best way to do this?
You could switch it to use ant. Maven comes with ant plugin. Run mvn ant:ant and it will generate the build.xml for you. This would make you dependent on ant though.
Probably the easiest thing to do is install m2e and m2e-wtp in Eclipse.
Then make sure your Maven project is packaged as a .war. See here for building a web app in Maven:
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
Eclipse will see it as a Dynamic Web App with all the configuration and deployment capabilities.
I've run non-Maven applications on an Eclipse embedded Tomcat server before and I found the instantaneous deployment upon saving invaluable. However after starting a Maven project I didn't find any easy way to continue doing this.
Using WTP and the Dynamic Web Module Project Facet seems to wreck the project's Maven nature. Using JRebel is not possible in our company. Googling didn't provide any results that would work without again removing the project's Maven support. Is there any other way or am I doing it wrong?
Install m2elipse with WTP extension. Import your Maven WAR project. m2eclipse will configure Eclipse for and your can continue using your Tomcat in WTP.
I have Maven2 war project built, I'm using the cargo start plugin, and it works great for deploying the web app. To run the maven command, I use a .bat file in my workspace, and I have en external run config to run the the bat file. I can't seem to stop the server from the Eclipse console, or re-deploy.
Does anyone have any advice on how quickly start/stop/re-deploy to Tomcat locally while developing.
Did you try JavaEE tools and m2eclipse? As far as I can see it should work well in most common situations. What m2eclipse does for you is to exactly map the maven configuration to an eclipse projects with the necessary facets set. Also, if the Dynamic Web Application facet is set for your project, you will be able to deploy it to a Tomcat server that you set up in the Server view of JavaEE tools. This configuration allows hot redeploy.
More information on JavaEE tools:
http://eclipse.org/home/categories/index.php?category=enterprise
There is a full Eclipse distribution with the EE tools available on their download site:
http://www.eclipse.org/downloads/
m2eclipse is freely available from Sonatype:
http://m2eclipse.sonatype.org/
At work we use the mentioned software as well. Additionally we use the JBoss tools that provide a feature called Project Archives that let you individually build your web application archive (ear/war/...).
To get startet you should perhaps start a fresh workspace and import the existing maven project (via the import existing maven project wizard). If everything went fine you can set up your tomcat in the server view. Maybe switch to the Java EE perspective. Right click on the newly added server and select Add to add the dynamic web project you just imported. If it doesn't show up in the list try to update the project configuration via the project's maven context menu.
Well, you could use cargo:redeploy to Undeploy and deploy again a deployable (that's a shortcut to cargo:deployer-redeploy). But I personally don't use Cargo this way, I use it mostly for integration testing (i.e. during the build) and use Eclipse WTP during development (this works whether you're using the maven eclipse plugin or m2eclipse).