Jar deployment in Netbeans - howto? - java

I've created Java app in Netbeans,
today I moved that app into Maven project,
I've created all dependencies in pom.xml, and application builds succesfuly and runs as before Maven migration.
However I have problem with deployment,
I was trying to use that Deployment of artifacts with FTP (Maven Deploy Plugin) but after inserting Netbeans project is broken.
My questions are:
What is easiest way to copy jar and maven files to some server by ftp or scp after pressing F6 in Netbeans (build button),
also how to run that app? before Maven I was using WinSCP to copy jar file, I've copied also lib directory with dependencies and I was using:
java -jar app.jar
Can Maven on remote host use java7 not system java?
I have jdk7u4 untarred on server, and I'm using that to run my application.
Can maven invoked by command line be handled by system java, but run application from java7 or I have to have only java7 in PATH?
Can Maven be bundled to single jar so I can run:
maven app.jar PARAM1 PARAM2..

Related

how to configure Wildfly to deploy Maven project

I'm learning Maven with eclipse and a liitle bit confused on how to deployed it on a remote server.
Before using Maven I created a web project and exported it as ear file and copied to the server's deployment folder. With Maven do I follow the same step? Do I need to install maven at wildfly server by modify the configuration xml? Thx.
Use maven only to produce artifacts(jar, war, ear). I was in the same position a couple of years back and found a useful link to build a project as an ear with maven.
For the remaining tasks, I coded Shell script to move the artifact from /target directory to wildfly10 \standalone\deployments.
It could also be achieved without any script using symbolic links.Just cd to your \standalone\deployments directory and:
ln -s [ABSOULUTE-PATH-TO-YOUR-WAR/EAR-FILE] [NAME-OF-EAR]
That's it. If you are more interested in symbolic links you may read here

Maven3: run plugin as root user

I use IntelliJ Idea for developing, and now i want to use maven project for WAR packaging and deploying to Glassfish4 server. After latest update of OSX (v.10.10.3), glassfish4 must be started from sudouser, so i have a question: How can i pass to maven that this plugin (glassfish:start-domain) must be running from root?
I try to run this command in terminal, but it doesn't help
sudo mvn glassfish:start-domain

NoClassDefFoundError when deploying WebLogic application from Eclipse

I'm working with Maven and WebLogic. When building my application with Maven, I can successfully install it manually on my local Weblogic, using the Admin Console.
When trying to deploy this same application on the server using Eclipse IDE, I get a NoClassDefFoundError. (I tried both with "Publish as virtual application" and "Publish as an exploded archive" in the Oracle Weblogic Server tools in Eclipse).
The structure of my application is the following:
MyApp.ear contains:
- MyWar1.war
- MyWar2.war
- MyEjb.jar (ejb module, using maven-ejb-plugin)
- MyJar.jar (another project, as dependency)
And it's this MyJar.jar that seems to be not found in the classpath. I've checked that in the Eclipse settings, this project is include in the Java Build Path\Project, Java Build Path/Order and Export and in the Deployment Assembly for the MyEjb project.
I've also checked the folder build by Eclipse, eclipse-workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\MyApp, where I can see the folder APP-INF\lib\MyJar.jar with the corresponding .class files. And when I try to manually manually install this folder, I got the same error (NoClassDefFoundError).
I'm using Weblogic 10.3.3, Maven 3.2.1, Eclipse 4.4.0 (20140612-0600) and Oracle WebLogic Server Tools 7.2.1.201407111426.
Any ideas how I can investigate this problem ?
Moving the dependencies from APP-INF/lib/ to lib/ folder seems to fix the problem, but I have no idea why.

Mirror API in Eclipse

I downloaded the glass-java-starter from github and followed all of the instructions on the glass developers site. I got it imported into Eclipse as a Maven existing project as instructed and I changed the oAuth file ID and Secret as specified. When I try to start the project or debug the project I am getting the following exception: Source not found for http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException. The instructions give a command line command for running the project, $ mvn jetty, but nothing for Eclipse. How do I debug this project with Eclipse?
You will need to use one of the maven plugins available for Eclipse to initiate the run:jetty goal.
There are a few available. One of them is Eclipse m2e.
Install the plugin
Create a new run configuration of type Maven Build
Specify a goal of jetty:run
Other solution would be:
set jetty debug port:
export MAVEN_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y'
then run jetty through maven command line
mvn jetty:jetty
After that use Eclipse remote debugger on port 4000.
The war file, product that mvn produce in this sample app is compatible with tomcat or any other standalone server, so just build a war to "webapp" directory of standalone tomcat or jetty or "deploy" directory of standalone JBoss.
Eclipse has plenty of plugins to run those in debug mode.

Tomcat not uploading all files

When i make the war i see the XCV.Jar, but I add the project on Tomcat (IDE eclipse), and when I deploy it, I have all jars except XCV.Jar (This jar is the parent of the project I deployed).
When you deploy to Tomcat from Eclipse it often fails to clean up the work directory directory. Try to clean $TOMCAT_HOME/work/Catalina// and the web apps directory then try redeploying.
If you are running tomcat inside eclipse you're asking for trouble. Its often better to build and validate the .war independently(with ant or maven) then deploy manually or with a script.

Categories