After you have added a new dependency, you could have exception like this:
NetBeans error:
--- exec-maven-plugin:1.2.1:exec (default-cli) @ integration ---
java.lang.NoClassDefFoundError: path/to/the/class/ClassName
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: package.ClassName
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
IntellijIdea error:
Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts
Tuesday, December 29, 2015
Wednesday, March 5, 2014
static root folder for maven projects
Static files could be copied here:
<maven-project-root>\src\main\webapp\resources
They are accessed on server on URL:
<server_address>/resources
Example:
<maven-project-root>\src\main\webapp\resources\x.txt
could be accessed on
http://localhost:8080/resources/x.txt
In come cases, the content changes are actualized without server restart. For example with:
mvn jetty:run
<maven-project-root>\src\main\webapp\resources
They are accessed on server on URL:
<server_address>/resources
Example:
<maven-project-root>\src\main\webapp\resources\x.txt
could be accessed on
http://localhost:8080/resources/x.txt
In come cases, the content changes are actualized without server restart. For example with:
mvn jetty:run
Thursday, June 27, 2013
Propagating java system properties to maven project code - issue solved
Issue description: I have got Hudson/Jenkins project. It is build via maven. Maven "Goals and options" is set to
test -DxxxApiConfigFile=config-xxxApi-client-jenkins
Starting console command "mvn test -DxxxApiConfigFile=config-xxxApi-client-jenkins" behaves correctly - the system property is set. But running
Solution: Maven field "Goals and options" has to be set to:
-DargLine="-DxxxApiConfigFile=config-xxxApi-client-jenkins" clean test
or even better:
-DxxxApiConfigFile=config-xxxApi-client-jenkins -DargLine="-DxxxApiConfigFile=config-xxxApi-client-jenkins" test
Source: http://www.cowtowncoder.com/blog/archives/2010/04/entry_385.html
test -DxxxApiConfigFile=config-xxxApi-client-jenkins
Starting console command "mvn test -DxxxApiConfigFile=config-xxxApi-client-jenkins" behaves correctly - the system property is set. But running
Solution: Maven field "Goals and options" has to be set to:
-DargLine="-DxxxApiConfigFile=config-xxxApi-client-jenkins" clean test
or even better:
-DxxxApiConfigFile=config-xxxApi-client-jenkins -DargLine="-DxxxApiConfigFile=config-xxxApi-client-jenkins" test
Source: http://www.cowtowncoder.com/blog/archives/2010/04/entry_385.html
Tuesday, January 1, 2013
maven - Uncompilable source code error
Caused by: java.lang.RuntimeException: Uncompilable source code - package xxxxxxx does not exist.
Tuesday, June 19, 2012
Searching in default maven repository
http://repo1.maven.org/maven2/ is the default repository for Maven 2 & 3, but many times it is hard to find the project artifactId, groupId and version in it.
Monday, June 11, 2012
log4j in maven project
Adding support for log4j is realized via maven dependency. You have to edit pom.xml file, and add these lines:
Wednesday, March 28, 2012
Monday, March 19, 2012
Adding external jar libraries to maven project
You have to add something like this in your pom.xml:
<dependency>
<groupId>com.xxx.yyy.messages</groupId>
<artifactId>xxxyyyMessages2</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/../xxxyyyMessages2/target/xxxyyyMessages2-2.0-SNAPSHOT.jar</systemPath>
</dependency>
Monday, March 12, 2012
Making jar with dependency jars incorporated with maven
I want to start my program from the clear console. Here is the code, which has to be placed in pom.xml:
Tuesday, January 31, 2012
java.lang.OutOfMemoryError: PermGen space - Cause and Solution
The error was (in maven):
java.lang.OutOfMemoryError: PermGen space
Solution:
If you build with maven:
MAVEN_OPTS="-Xms512m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=512m"
AND
JAVA_OPTS="-Xms512m -Xmx768m"
If you use other tools, check their OPTS configuration - may be there is analogue.
java.lang.OutOfMemoryError: PermGen space
Solution:
If you build with maven:
MAVEN_OPTS="-Xms512m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=512m"
AND
JAVA_OPTS="-Xms512m -Xmx768m"
If you use other tools, check their OPTS configuration - may be there is analogue.
Friday, October 21, 2011
solved maven error "NoClassDefFoundError" ComponentLifecycleException
niskia:/xxyyzz# mvn jar:jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/component/repository/exception/ComponentLifecycleException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
at org.codehaus.classworlds.Launcher.getEnhancedMainMethod(Launcher.java:195)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:294)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.component.repository.exception.ComponentLifecycleException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 9 more
The solution was reinstalling maven. For debian is done by:
apt-get remove maven2
apt-get install maven2
Thursday, July 28, 2011
Adding JAXB / jxc support in maven
Put your schemas (*.xsd) and bindings (*.xjb) into the src/main/resources folder.
Correct pom.xml as you add:
Correct pom.xml as you add:
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<args>
<arg>-nv</arg><!-- this disable strict schema validation -->
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
Subscribe to:
Posts (Atom)