Installing Maven tool support in vanilla Eclipse IDE

If you download an Eclipse bundle like the Eclipse IDE for Java EE developers, you’ll get Maven support built in, but if you download a vanilla Eclipse install (like from using from of the daily builds), you’ll need to install many pllugins yourself.

Eclipse support for Maven is provided via the m2Eclipse plugin, there are installation instructions here:

I’ve had luck using these installer buttons before, but on this daily build for M1 they don’t seem to do anything. Instead I used the manual approach by adding a new ‘site’ in ‘Add New Software, ‘ adding https://download.eclipse.org/technology/m2e/releases/latest/ and then selecting ‘Maven Integration for Eclipse’ :

Done!

Serverless framework deploy for Java AWS Lambdas

The Serverless framework ‘serverless deploy’ deploys whatever .jar you have packaged and ready to go within your source project.

If you make local code changes but don’t re-build your .jar, serverless thinks you don’t have any changes to deploy:

$ serverless deploy
...
Serverless: Packaging service...
Serverless: Service files not changed. Skipping deployment...

If you’re building a maven-based project, ‘mvn clean package’ first, then run your ‘serverless deploy’.

Spring Boot: cannot find classfile ConfigurableApplicationContext (invalid LOC header)

Spring Boot with it’s maven starter dependencies is incredibly helpful to get a simple Spring Boot app up and running in no time, but occasionally you run into weird errors in Eclipse like:

The project was not built since its build path is incomplete. 
Cannot find the class file for 
org.springframework.context.ConfigurableApplicationContext. 
Fix the build path then try building this project

Or doing a mvn compile from your shell, something like:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error reading /Users/kev/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar; invalid LOC header (bad signature)

Assuming you’re already using the Spring Boot Starter Web dependency:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

.. errors about Classes not found or errors reading .jars (‘invalid LOC header’) could be related to jars in your local .m2 repo being corrupt.

This is pretty easy to correct if you go into your ~/.m2/repository/ and delete your downloaded dependencies. You can be more specific in what you delete if you have something that you can easily identify as coming from a specific dependency.

Adding dependent jars to your OpenShift Maven repo – take 2

Looking at my last post when I last did this, it’s been a year since I last deployed something to OpenShift with my own custom dependent jars 🙂 And looks like some of the paths might have changed since last time, but the approach is still the same.

What worked for me this time:

mvn install:install-file -DgeneratePom=true 
  -Dfile=../../jar-file-name-inc-version-number.jar 
  -DgroupId=your-group-id -DartifactId=artifact-name 
  -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

Looks like the relative path to where the jar gets copied to in your remote account changed slightly since last time.

The odd thing is I still ran into issues with my prebuild script file losing it’s executable flag, and it never seems to run as part of my build, but I can run it manually my ssh’ing into my account and just running it by hand.