I have a project written in Java using Eclipse and I have a lot of users (students) that every day have to install and run it.
I'm searching a common configuration like npm start.
My idea is to install something or to say to my user: go in this directory and do this command for running like for Angular (npm install & npm start).
Is it possible or no?
Or to have a script that configure Eclipse workspace in automatically way.
Related
I have a multi-module project on maven. It is quite ancient and is going with a special dance with a tambourine.
Project structure
root
|__api
|__build
|__flash
|__gwt
|__server
|__service
|__shared
|__target
|__toolset
To build such a project, I have a special script that needs to be executed while at the root of the project.
./build/build_and_deploy.sh
When building on Windows, there are a lot of problems (problems with long paths, symbols and line separators get lost, etc.), so I want to build this project in docker.
At first I wanted to connect docker-maven-plugin from io.fabric8 as a plugin in maven, but as I understand it, it cannot run the build of itself in docker.
So I tried to write Dockerfile and ran into the following problems
I don't want to copy the .m2 folder to docker, there are a lot of dependencies there, it will be quite a long time.
I don't want to copy the project sources inside the container
I couldn't run the script./build/build_and_deploy.sh
How I see the solution to this problem.
Create a dockerfile, connect maven and java8 to it, and bash
Using Volume to connect the sources and maven repository
Because I work through VPN and the script is deployed, you need to find a solution to the problem through it (proxy/port forwarding???)
If you have experience or examples of a similar script or competent advice, then I will be glad to hear it
You can perform the build with Maven inside Docker.
For that you basically trigger something like docker build ., and the rest is inside the Dockerfile.
Start off from a container that has Maven, such as maven.
Add your whole project structure
Run your build script
Save your build result
To save your build result, you might want to upload it to some repository, or store it in a mounted volume that is available after the container run as well. Alternatively copy it to the next stage if you use a multistage docker build.
If you want to prevent repeated downloads of the .m2 directory or have many other dependencies in there, also mount it as volume when running the container.
I am struggling to get a simple maven project running on Jenkins, which runs on my new Ubuntu server (16.04.)
I have installed Jenkins onto an Ubuntu, installed Maven and JDK.
I can connect to bitbucket and access my remote repository and get hold of my code. However, when I try to build I get the message
cannot run program "mvn" (in directory "/var/snap/jenkins/workspace/project") no such file or directory
I have added $JAVA_HOME and $MAVEN_HOME to my /etc/environment as variables and also into my path.
I have looked at the Global Tool Configuration, but this seems to be no help.
When I set the Maven installer to point at Maven home I get a message
/usr/share/maven is not a directory on the jenkins master
When I try to get Jenkins to install maven for me I get
Failed to install <truncated>apache-maven-3.5.3.bin.zip to /var/snap/jenkins/6/tools
...
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must not be empty
I think I have hit a dead end. What could I be missing, or how can I get past these obstacles ?
Many Thanks
Go to Manage Jenkins -> Global Tool Configuration. I always elect to have Jenkins install and manage Maven, vs install and bring my own.
It has taken a long time to get to the bottom of this.
By default the
sudo apt-get install jenkins
seems to install a Snap version of Jenkins.
This snap version holds data in different locations (which is why I struggled to find the initialAdminpassword
Additionally, the snap setup only has a JRE, which cannot be overridden to a JDK, and therefore does not seem to work properly with Maven.
Eventually, I completely uninstalled Jenkins, and then followed the instructions on the official Jenkins site:
https://pkg.jenkins.io/debian-stable/
This overrides the base apt-get packages, and points to the jenkins.io packages.
From here on in, it all behaved as per the documentation.
I'm new to Angularjs and i'm trying to run first angular program with Spring. I downloaded the code from here: http://javahonk.com/spring-mvc-angularjs-integration/. Imported it as a maven project. Downloaded JSDT and AngualrJs plugin from eclipse marketplace but it's still not running. There is no error message. I'm running this on tomcat 7. What am I missing?
Any help would be appreciated?
I'm not a Eclipse user. so I have no idea for that. But you can use nodejs as a static server. it is explained here
1) Install nodejs for your OS
2) Run this command in a terminal (console)
> npm install http-server -g
3) Start server
> cd /path/to/your/project
> http-server -o --cors
Now you can access your project from browser http://localhost:8080/yourfile.html
Work in Eclipse and just refresh page on browser to see changes.
If you are working on a Spring Application within Eclipse IDE, your best alternative would be to start you appliction using an embedded Application Server (Best I would recommand are Jetty or Tomcat if you ain't need EE level components).
You can follow this link, which holds basic steps for adding a new Application Server within Eclipse IDE.
Once you have added a new application server, you can deploy your application in it then launch it and you should have your applcation reachable at http://localhost:8080/SpringMVCAngularJS.
A good alternative when using Maven as a build tool, is using an embedded AS plugin such as Tomcat7 Plugin or Jetty Plugin. This plugin will provide the ability to start your applcation using the Maven different goals (which does not require adding a new AS into Eclipse IDE).
I've pushed a sample module based on the tutorial you mentioned. YOu can test the above described plugin as follows in a *nix shell (You may need to setup git if not already done):
git clone https://github.com/tmarwen/stackoverflow-showcase.git
cd stackoverflow-showcase/springmvc-angularjs
mvn tomcat7:run
we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.
Currently I'm developing project with GAE/GWT. I'm using IntelliJ IDEA CE so there's no simple way of doing GWT development (it doesn't contain GWT plugin). However it seems to be possible to run the GWT server in development mode, so it will be able to pick up the changes made to classes.
There is some solitions to make IDEA CE GWT-friendly, like http://java.dzone.com/tips/gwt-development-intellij-idea. However nothing about GAE+GWT.
So now I'm looking for the way of starting GAE application (mvn gae:run) with having GWT in development mode. Can you please advice?
So what did I do in order to get it working:
1) add output directory settings so maven will generate files in place where GWT will expect them:
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
2) configure maven-gwt-plugin to respect your GAE app home
<extraJvmArgs>-Dappengine.sdk.root=${appengine.sdk.root}</extraJvmArgs>
3) configure maven-gae-plugin to provide correct paths for GAE home
<configuration>
<sdkDir>${appengine.sdk.root}</sdkDir>
<jvmFlags>-Dappengine.sdk.root=${appengine.sdk.root}</jvmFlags>
</configuration>
4) set the property to point to the home of GAE installation:
<appengine.sdk.root>/path/to/gae/home</appengine.sdk.root>
and then you will be able to run the server
mvn gwt:run
as well as debug it
mvn gwt:debug
works fine with IntelliJ IDEA CE 10, but don't forget to run
mvn war:exploded
after every "mvn clean" task
Just add following lines to gwt-maven-plugin configuration:
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<appEngineVersion>${gae.version}</appEngineVersion>
<extraJvmArgs>-Dappengine.sdk.root=${project.build.directory}/appengine-sdk/appengine-java-sdk-${gae.version}</extraJvmArgs>
Then run your application as usually - mvn gwt:run
In our project we use this steps - first run maven task -
mvn gae:debug and the second is remote connection on specific port(5005) to specific address.
If you required more explanation please welcome.