!!! NOTE 1: This is still a work in progress with lots of sharp edges that cuts and bleed ;) !!! Note 2: Prerequisite to follow shopizer documentation Build The Application.Starting UpThis steps are done using Eclipse Luna. Good to make sure that latest m2e plugin is installed in eclipse. Install AspectJ Development tool (credit to Arjan reply in StackOverflow here). Use the Menu, Help->Install New Software. Then install AspectJ Maven connector. Use the Menu, Windows->Preferences. On the preferences windows expand Maven and select Discovery in the tree list on left hand side. After that click Open Catalog button, find AspectJ and put a check mark on it. Click finish to start installation. Using same step as installing AspectJ Maven connector, but this time install m2e-apt. The code base actually have 2 sub project. sm-core mentioned above is actually the library part. While sm-shop is web app part that going to be run by jetty. SM COREImport into eclipse as maven project.There is an error in the sm-core pom.xml file for maven-apt-plugin. Modifying maven-apt-plugin version to 1.0.4 make this error go away.
Also add maven-source-plugin to sm-core pom file. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> This plugin is for debugging. Without it browsing sm-core sources from sm-shop using eclipse will result to source not found. Only do the following step if bellow error is encountered in sm-core.pom.
This StackOverflow page discus the issue. Solution that work for me is by eis that suggest setting -vm option in eclipse.ini to a specific jdk which is described in this StackOverflow page or even better this wiki page. Modify sm-shop pom to include jetty-maven-plugin. This is the magic that will allow us to run and debug Shopizer using jetty. The scanIntervalSeconds configuration above is for debugging later. This allow java code to be change and debugged without restarting jetty. Functionality called hot swapping. Test this using mvn jety:run in a terminal/console which result to following errors: Error:
Adding the following to pom.xml solve the problem as per this link. <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper-el</artifactId> <version>7.0.27</version> </dependency>
Apparently this is just a log message and are harmless/not a problem and can be ignored. Refer to link.Navigate to localhost:8080 or localhost:8080/admin and the web app should come up, alive and kicking. Cleaning UpThis looks cool. Adding properties like variable declaration in script. Conveniently put version definition at beginning of pom.xml file. <properties> ... <tomcat-jasper-el.version>7.0.27</tomcat-jasper-el.version> <jetty-maven-plugin.version>8.1.15.v20140411</jetty-maven-plugin.version> </properties> And changing the version to reflect above properties <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper-el</artifactId> <version>${tomcat-jasper-el.version}</version> </dependency> ... <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty-maven-plugin.version}</version> </plugin> Run and DebuggingWith mvn in system path variable, running the web app in terminal or command prompt is just the matter of executing mvn jetty:run Running this in eclipse without just a bit of configuration is simplified with the use of m2e and jetty-maven-plugin. Click on Run Configurations to configure a new run named start. As bellow configuration in the Run Configurations window. Simply add jetty:run as the goal. And don't forget to check Debug Output as we need this in debugging step later. Click Apply and then the Run button to run it. Or use the Start shortcut automatically added as bellow: To debug, set a break point And use the Start shortcut in Debug as bellow: Navigate to admin page, enter username/password and click Login. Check the IDE, If everything is OK, program execution will be paused at the set breakpoint. |
Tech Blogging >