Solution: Add the switches after the goal, e.g. test -e -X.
![]() |
| Figure 1: Run Configuration with switch |
A blog to log all the findings I have found during my programming life before I forget. ^.^
Solution: Add the switches after the goal, e.g. test -e -X.
![]() |
| Figure 1: Run Configuration with switch |
Problem: Unable to access binding information for class. Make sure the binding has been compiled.
HTTP ERROR 500 Problem accessing /lucky-number-ws/LuckyRequest.wsdl. Reason: Error creating bean with name 'payloadMapping' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'luckyServiceEndpoint' while setting bean property 'endpointMap' with key [TypedStringValue: value [{http://localhost:8080/luckyservice/services/}/LuckyRequest], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'luckyServiceEndpoint' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.jibx.JibxSystemException: Unable to access binding information for class com.blogspot.adaprognotebook.message.LuckyResponse Make sure the binding has been compiled; nested exception is org.jibx.runtime.JiBXException: Unable to access binding information for class com.blogspot.adaprognotebook.message.LuckyResponse Make sure the binding has been compiledSolution: Run "jibx:bind" goal to compile the binding.
[INFO] Scanning for projects... [INFO] [INFO] ---------------------------------------------------------------- [INFO] Building Lucky Number Web Service 0.0.1-SNAPSHOT [INFO] ---------------------------------------------------------------- [INFO] [INFO] --- jibx-maven-plugin:1.2.4.5:bind (default-cli) @ lucky-number-ws --- [INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s) [INFO] ---------------------------------------------------------------- [INFO] BUILD SUCCESS [INFO] ---------------------------------------------------------------- [INFO] Total time: 1.772s [INFO] Finished at: Tue Feb 19 18:01:43 CST 2013 [INFO] Final Memory: 11M/24M [INFO] ----------------------------------------------------------------Problem: Plugin {plugin name} or one of its dependencies could not be resolved: Failed to read artifact descriptor for {plugin name}: Could not find artifact {plugin name}
[INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 0.079s [INFO] Finished at: Tue Feb 05 12:14:23 CST 2013 [INFO] Final Memory: 5M/8M [INFO] ----------------------------------------------------------- [ERROR] Plugin org.jibx:maven-jibx-plugin:1.2.4-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.jibx:maven-jibx-plugin:jar:1.2.4-SNAPSHOT: Could not find artifact org.jibx:maven-jibx-plugin:pom:1.2.4-SNAPSHOT -> [Help 1]Cause: The repository does not contain the plugin.
Solution: Add the <pluginRepositories> sections in the pom.xml file.
pom.xml
<pluginRepositories>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://repository.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Problem: Error assembling WAR: webxml attribute is required.
[INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 1.694s [INFO] Finished at: Tue Feb 05 15:21:46 CST 2013 [INFO] Final Memory: 10M/21M [INFO] ----------------------------------------------------------- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project {project name}: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]Cause: The maven-war-plugin plugin is not configured.
Solution:Add the following section in the pom.xml.
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
Problem: class org.jibx.runtime.JodaConvert not found in classpath.
[INFO] --- jibx-maven-plugin:1.2.4.5:bind (default-cli) @ memberservice --- [INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s) Running binding compiler version jibx_1_2_5-SNAPSHOT [INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 0.640s [INFO] Finished at: Tue Feb 05 16:53:07 CST 2013 [INFO] Final Memory: 5M/14M [INFO] ----------------------------------------------------------- [ERROR] Failed to execute goal org.jibx:jibx-maven-plugin:1.2.4.5:bind (default-cli) on project memberservice: Internal error - class org.jibx.runtime.JodaConvert not found in classpath -> [Help 1]Cause: Wrong version of JiBX is used.
Solution:Update the version of JiBX dependencies in the pom.xml.
pom.xml
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>1.2.4.5</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-extras</artifactId>
<version>1.2.4.5</version>
</dependency>
Problem: 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing.
[WARNING] Some problems were encountered while building the effective model for {project name}:war:1.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 83, column 15 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.Cause: Version number is not set for the maven-compiler-plugin plugin.
Solution:Set the version number under the <artifactId>
pom.xml
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
Problem: File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependentCause: Encoding of the source files is not set.
Solution: Set the encoding of the source files.
pom.xml
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>
Problem: The project uses or overrides a deprecated API.
[WARNING] Note: D:\workspaces\Test\LuckyNumberWebService\src\test\java\com\blogspot\adaprognotebook\client\TestLuckyServiceClient.java uses or overrides a deprecated API. [WARNING] Note: Recompile with -Xlint:deprecation for details.Cause: The project uses or overrides a deprecated API.
Solution: Set "-Xlint:deprecation" as compiler argument during compilation.
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:deprecation</compilerArgument>
</configuration>
</plugin>
![]() |
| Figure 1: Add Archetype. |
![]() |
| Figure 2: Can't resolve Archetype. |
<profiles>
<profile>
<repositories>
<repository>
<id>mvn-repository</id>
<name>MvnRepository.com</name>
<url>http://mvnrepository/</url>
</repository>
</repositories>
</profile>
</profiles>
Problem: Java.Lang.ClassNotFoundException: Org.Objectweb.Asm.Type
Caused by: java.lang.NoClassDefFoundError: org.objectweb.asm.Type
Cause: asm.jar is missing.
Solution: Add the dependency in the project's pom.xml.
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
Problem: Project configuration is not up-to-date with pom.xml. Run project configuration update.
Description Resource Path Location Type Project configuration is not up-to-date with pom.xml. Run project configuration update {Project Name} line 1 Maven Configuration ProblemCause: Project configuration is not up-to-date.
Solution: Run "Maven" -> "Update Project Configuration...".
![]() |
| Figure 1: Update Project Configuration |
Installation
Implementation
It is assumed that there is already a web application project on-hand. You may reference to another article "First Hello World Web Application using Maven" to create one.
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<scanIntervalSeconds>60</scanIntervalSeconds>
<stopPort>7788</stopPort>
<stopKey>foo</stopKey>
<webApp>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jetty.version>6.1.26</jetty.version>
</properties>
<repositories>
<repository>
<id>central-repo-browser</id>
<name>The Central Repository Browser</name>
<url>http://search.maven.org</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<scanIntervalSeconds>60</scanIntervalSeconds>
<stopPort>7788</stopPort>
<stopKey>foo</stopKey>
<webApp>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jetty.version>8.1.9.v20130131</jetty.version>
</properties>![]() |
| Figure 1: New Configuration for starting Jetty. |
![]() |
| Figure 2: New Configuration for stopping Jetty. |
![]() |
| Figure 3: New Configuration for compilation. |
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies/>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com</nonProxyHosts>
</proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings/>
A hands-on guide to enable Maven in existing Java projects in Eclipse.
In order to facilitate the build process in the software development life cycle, Maven can be used as a software project management and comprehension tool.
Projects are first configured as Maven-enabled. The POM (Project Object Model) file, which is an XML file (pom.xml), contains information about the project and configuration details used by Maven to build project. Configuration includes project dependencies, the plugins or goals that can be executed, the build profiles and so on.
![]() |
| Figure 1: Architecture of the Development Environment |
Installation
Design
Suppose that three projects are created: myapp-common, myapp-web and myapp-admin. As shown in Figure 4, myapp-web and myapp-admin have dependency on myapp-common, and this is configured in the POM file.
![]() |
| Figure 4: Projects Dependancies |
Implementation
mvn archetype:generate -DgroupId=com.blogspot.adaprognotebook-DartifactId=myapp-common -DarchetypeArtifactId=maven-archetype-quickstart
mvn archetype:generate -DgroupId=com.blogspot.adaprognotebook-DartifactId=myapp-web -DarchetypeArtifactId=maven-archetype-webapp -Dpackage=war
mvn archetype:generate -DgroupId=com.blogspot.adaprognotebook-DartifactId=myapp-admin -DarchetypeArtifactId=maven-archetype-webapp -Dpackage=war
myapp-common
|-- pom.xml
|-- src
|-- main
|-- java
|-- resources
|-- test
|-- java
myapp-web
|-- pom.xml
|-- src
|-- main
|-- resources
|-- webapp
|-- WEB-INF
|-- web.xml
|-- index.jsp
myapp-admin
|-- pom.xml
|-- src
|-- main
|-- resources
|-- webapp
|-- WEB-INF
|-- web.xml
|-- index.jsp
![]() |
| Figure 5: Import existing projects into Workspace |
![]() |
| Figure 6: Configure Installed JRE |
<servers>
<server>
<id>nexus-releases</id>
<username>deployment</username>
<password>test123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>test123</password>
</server>
</servers>
<mirror>
<id>nexus</id>
<name>nexus public mirror</name>
<url>http://{Host of the Nexus server}/nexus/content/groups/public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
<distributionManagement>
<repository>
<id>nexus-snapshots</id>
<name>Samvo Repository for Maven</name>
<url>http://{Host of the Nexus server}/nexus/content/repositories/snapshots/</url>
</repository>
</distributionManagement>
<server>
<id>tomcat</id>
<username>ad</username>
<password>test123</password>
</server>