git reset HEAD^ --mixed // delete the latest local commit, but keep the working directory
git stash save // stash away working directory changes
git pull // pull the remote commit that you originally amended
git stash apply // apply the stash on it
git add -u // stage the changes
git commit // commit the changes that you originally amended to a new commit
Tuesday, May 24, 2016
GIT: Accidentally amended a commit that was already pushed? Here's how to fix it.
Friday, May 6, 2016
Run a Maven Vaadin application on an embedded Jetty server in Eclipse
Source: Embedding Jetty
Add Maven Dependencies
<properties>
<jetty.version>9.3.0.v20150612</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-continuation</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
Create a Server
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.resource.PathResource;
public class VaadinApplicationServer
{
public static void main( String[] args ) throws Exception
{
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.setBaseResource(new PathResource(new File("src/main/webapp")));
context.addServlet(MyUIServlet.class, "/*");
server.setHandler(context);
server.start();
server.join();
}
}
Run as Java application
Now it is possible to run your Vaadin project as a Java application with the Jetty VaadinApplicationServer class.
Getting started with a Maven Vaadin project in Eclipse without the Eclipse Vaadin Plugin
Environment: Eclipse Luna for Java SE on Windows 10 with Apache Tomcat server and Maven
Install Eclipse software
Source: WTP FAQ: How do I install WTP?
- either install Eclipse IDE for Java EE Developers, which has the needed dependencies by default,
- or install the following software for the Eclipse IDE for Java Developers:
- Eclipse Java EE Developer Tools
- JST Server Adapters Extensions
The installation is done by the following procedure:
- in Eclipse, navigate to Help -> Install New Software...
- select Work with: --All Available Sites--
- expand Web, XML, Java EE and OSGi Enterprise Development category menu
- select the following:
- Eclipse Java EE Developer Tools
- (Eclipse Java Web Developer Tools)*
- JST Server Adapters Extensions
- (JST Server Adapters)*
- (JST Server UI)*
- click Next, click Next again, accept Licence agreement, click Finish to install.
As a result, you are able to add a Server runtime.
Try it: follow the tutorial in the Eclipse Help: Adding the Apache Tomcat runtimes
As a result, you now have the Java EE perspective for Eclipse.
As a result, the Run on Server option becomes available for projects.
*(might be needed to fix errors)
*(might be needed to fix errors)
Add Maven Archetypes for Vaadin
Source: Set up a Vaadin project with Maven2- in Eclipse, navigate to Window -> Preferences
- expand Maven menu item, select Archetypes
- click Add Remote Catalog...
- Catalog File: https://repo1.maven.org/maven2/archetype-catalog.xml
- Description: Maven2
- click OK.
As a result, when creating a new Maven project, the Vaadin archetypes became available.
Try it:
- in Eclipse, go to File -> New -> Other... -> Maven -> Maven Project
- leave the Create Simple Project checkbox unselected, click Next
- Filter for Vaadin, select the com.vaadin archetype you would like to create, click Next
- proceed with project creation.
Here is a description of the Archetypes: https://vaadin.com/maven#archetypes
Set up Facets for your project
In order for Eclipse to recognize your Vaadin project as a Web Project that can be deployed to a server, you need to do the following:
- in Eclipse, navigate to your vaadin project's Properties (right click on project name in Project Explorer, select Properties)
- select Project Facets
- click Convert to faceted form...
- leave the Java option selected
- select the option Dynamic Web Module, set version to 3.1
- click Further configuration availiable...
- set Content directory to src/main/webapp (the default maven webcontent directory)
- select Generate web.xml deployment descriptor and click OK.
As a result, you can deploy your project to the server.
Try it: follow the tutorial in Eclipse Help: Deployment: Deploy the Dynamic Web Project to the Server
Set up Project Deployment Assemblies
Add Maven repositories
In order for a the Maven dependencies to be deployed on the Server, you need to do the following:
- in Eclipse, navigate to your vaadin project's Properties (right click on project name in Project Explorer, select Properties)
- select Deployment Assembly
- click Add...
- select Java Build Path Entries, click Next
- select Maven Dependencies, click Finish
- click OK.
As a result, now your Vaadin web application should run on the server.
Ensure the rest is good
- Source --> Deploy Path
- /src/main/java --> WEB-INF/classes
- /src/main/resources --> WEB-INF/classes
- /src/main/webapp --> /
Build Vaadin plugin goals with Maven
In order for a Vaadin application to run, you first need to build the components.
The Plugin Goals can be found in the pom.xml: update-theme, update-widgetset, compile, compile-theme.
- in Eclipse, go to Run-> Run Configurations...
- right click on Maven Build select New
- Name your configuration
- Base directory is the project's directory
- Goals have to be separated by space. Copy-paste in the following:
- com.vaadin:vaadin-maven-plugin:update-theme com.vaadin:vaadin-maven-plugin:update-widgetset com.vaadin:vaadin-maven-plugin:compile com.vaadin:vaadin-maven-plugin:compile-theme
- click Apply.
- click Run to run the build.
Subscribe to:
Posts (Atom)