Deploying Maven project tusing eclipse jboss tools - java

I'm trying to get my maven project deployed to Jboss AS 7.1 using the jbos tools plugin version 4.3.1.FINAL.
My project setup is
parentPom
common.jar
util.jar
mywebapp.war
When I run mvn clean install form both eclipse and command line the resulting target folder is the same atleast for the mywebapp.war and /mywebapp (folder)
If i copy either the folder or war file from the target folder directly into the servers /standalone/deployments directory. The application starts up without a problem.
However if I go to my server setup in eclipse which is pointing to the same base and do Add/Remove -> select mywebapp -> run
The problem is this doesnt copy all the files over to the server becasue when i run a diff I see a whole load of files missing. Consequently the build fails saying it canot load some annotation, presumably this is because some of the files are missing.
Ideally I wouldn't want to copy the war or folder manually and would love to be able to edit jsp/css/javascript files etc without having to go through this laborious task.

Related

Netbeans update generated project files from command line

I need to setup a periodic pull & build of a native Netbeans project on a Linux box and I don't want to open the project in the Netbeans GUI to make the generated files up-to-date.
There can be at least one file in a native Netbeans project that should be different on different machines: nbproject/private/private.properties. Here's an example of a web application to build for Glassfish:
deploy.ant.properties.file=/home/admin/.netbeans/8.2/config/GlassFishEE6/Properties/gfv3-155092097.properties
j2ee.platform.is.jsr109=true
j2ee.server.domain=/opt/glassfish-4.1.2/glassfish4/glassfish/domains/domain1
j2ee.server.home=/opt/glassfish-4.1.2/glassfish4/glassfish
j2ee.server.instance=[/opt/glassfish-4.1.2/glassfish4/glassfish:/opt/glassfish-4.1.2/glassfish4/glassfish/domains/domain1]deployer:gfv3ee6wc:localhost:4848
j2ee.server.middleware=/opt/glassfish-4.1.2/glassfish4
user.properties.file=/home/admin/.netbeans/8.2/build.properties
It is not under version control, but without it Ant cannot build projects that use the Glassfish server registered in Netbeans:
[admin#funktest v24testear]$ ant -quiet clean dist
BUILD SUCCESSFUL
Total time: 16 seconds
[admin#funktest v24testear]$ rm -f nbproject/private/private.properties
[admin#funktest v24testear]$ ant -quiet clean dist
BUILD FAILED
/home/admin/Downloads/v24test/v24testear/nbproject/build-impl.xml:156: The libs.CopyLibs.classpath property is not set up.
There's also build-impl.xml that is derived from project.xml and I would like to re-generate it too.
A workaround to this is including and referencing the required lib in your project. For example:
locate the JAR-file org-netbeans-modules-java-j2seproject-copylibstask.jar, which will typically reside in a location like C:\Program Files\NetBeans 8.2\java\ant\extra on a computer with NetBeans.
Copy that JAR into your project, f.x. project/ant/org-netbeans-modules-java-j2seproject-copylibstask.jar.
Open nbproject/project.properties and at the end of it add the line:
libs.CopyLibs.classpath=ant/org-netbeans-modules-java-j2seproject-copylibstask.jar
With the lib in your project and project.properties pointing to its location Ant should be able to build without an actual NetBeans installation.

Maven plugin for clean the tomcat target folder and war file

I want to know how can i remove the target folder and war file which created within webapps folder when i deploy the project.
I'm using eclipse IDE for the deploy project. I want to what is the maven plugin for this goal.
But if I used terminal for deploy the project i can used. But sometimes this command also unable to clean the webapps folder.
mvn clean compile war:war
Do you get an error message when using mvn clean ?
Do you have open files which are located in the structure under target? This prevents the target folder from being deleted.

what is org.eclipse.wst.common.component and how to use it for ant

I have an eclipse workspace (for work) that has an ear project that I use to "export"/deploy an ear file to a JBoss server.
However, they recently asked me to create an ant script that can build the workspace and create the ear, and I have done this successfully. The problem arises when I try to run my program with this ear that was built using the ant script; for deploying I'm simply copying the resulting ear file and pasting it into the JBoss/standalone/deployments folder and running the application.
The JBoss AS starts fine, but then I get a few exceptions that halt my application that I do not get when I do a build and deploy through eclipse. The two ear files are identical when viewing the two ear files using 7zip, however I see in the eclipse workspace, in the ear project, theres a .settings folder that has 4 files, one of them being org.eclipse.wst.common.component and I'm guessing this (if not all 4 files) is necessary when deploying somehow.
Does ecplise use this .settings folder and the files inside when deploying an ear? What happens during this process? and how can I replicate it in an ant script so that my application runs identically from either ant or eclipse builds?
EDIT
let me just add that none of the files in the .settings folder get packaged up in the ear file, so I'm guessing they're somehow used when eclipse does a build/deploy, but it doesnt get placed in the final ear product
thank you
Eclipse uses the data in org.eclipse.wst.common.component to figure out the dependencies needed for deployment. The file corresponds to the settings found in Eclipse when Right-clicking on an EAR project > Properties > Deployment Assembly.
E.g. if your EAR project has a dependency on a WAR project then Eclipse knows to include the WAR when deploying because of the Deployment Assembly settings which get stored in org.eclipse.wst.common.component
When building the EAR using Ant you need to add these dependencies manually (without relying on Eclipse metadata)

Deploying war file in STS using gradle

I have a web project in STS, that iam looking to deploy in Tomcat. The build file for the project is written in GRADLE. Using GRADLE'S build script, a war file is generated in build/libs.
But STS looks for the war file in workspace/metadata/plugins/org.eclipse.wst.server.core/ folder.
Now If I manually copy the generated WAR file from build/libs to this workspace/metadata/plugins folder, and then start the tomcat, everything works fine but I am not able to debug using breakpoints in STS.
How do I make sure that the war file from build/libs gets moved to workspace/metadata/plugins folder?
And, Why is STS looking to find the war in workspace/metadata/plugins folder. As the app-server is tomcat, should it not be looking in Tomcat/webapps folder to find the war?
I am not a eclipse fan nowadays but did you run eclipse plugin? you can add it to the gradle file
apply plugin: 'eclipse'
and then just run
gradle eclipse
check Eclipse Plugin
I don't believe STS deploys/runs your war file directly. That is, if you select the project and say "Run on Server", STS/eclipse will generate an exploded war to the wtp.deploy directory defined. You can control/alter this by editing the "run configuration" for your server. Just go to the "Arguments" tab and change the setting for the "-Dwtp.deploy".
You should really only use this STS mechanism for development purposes - as it is invaluable for that. To deploy an actual warfile to Tomcat you have a variety of options. You can start a tomcat instance with the manager UI enabled and upload the war file from the Tomcat GUI, you can just manually drop the war file into Tomcat's deployment area, or probably your best option - extend your gradle build scripts to include deploying the generated war file to a tomcat server. Hope this helps some.

Eclipse and SubClipse: How to deploy my own package with svn to a TomCat server?

I'm using SubClipse for Eclipse for my project.
And in this project I've added my own package "com.mytestpkg.www"
I then use TortoiseSVN to deploy my project on the TomCat server where the project is running, because i the easily can update the site with "SVN Update".
But using this method I always have to manually update my package by copying it from my Eclipse workspace build path to the WEB-INF folder classes/com/mytestpkg/www.
Is there a way to make Subclipse/SVN update this file directly with the other files?
Why don't you do this a more conventional way; e.g.
get Eclipse to create and deploy a WAR file
use Ant or Maven to build the WAR file and deploy it by hand. (The Maven way of building WAR files is really slick!)
Doing a checkout into a Tomcat server's webapps directory is ... weird. And you've got the problem of stopping the world seeing the .svn directories.

Categories