mvn eclipse:clean eclipse:eclipse -DdownloadSources -DdownloadJavadocs
Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts
Monday, December 26, 2011
Import maven project into eclipse with sources and javadocs
Friday, September 3, 2010
wikbook maven plugin errors
If you have the error
org.xml.sax.SAXParseException
or the error
[Fatal Error] :4:8: The content of elements must consist of well-formed character data or markup.
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
try to check the {code} section.
It should be as:
{code}
bla-bla
{code}
Tuesday, July 27, 2010
Monday, April 12, 2010
Eclipse: maven test debug
Project:
xcmis-restatom
Main class:
org.codehaus.classworlds.Launcher

Program arguments:
-DforkMode=never
clean
install -Dtest=org.xcmis.restatom.RepositoryCapabilityTest
VM arguments:
-Dclassworlds.conf=${M2_HOME}/bin/m2.conf
-Dmaven.home=${M2_HOME}
To add the library classworlds-1.1-alpha-2.jar
/home/alexey/java/maven2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar
Add sources.
Thursday, April 8, 2010
HOWTO install Maven for Ubuntu
Download maven at
Unzip it to java folder.
Create symlink
ln -s /home/alexey/java/maven-2.0.11 /home/alexey/java/maven2
Edit .bashrc
export MAVEN_HOME=/home/alexey/java/maven2
export PATH=$MAVEN_HOME/bin:$PATH
Wednesday, March 31, 2010
NullPointerException org.gjt.xpp.sax2.Driver.getIndex with cxf-codegen-plugin
If you faced with stacktrace as below:
PROBLEM:
By using the plugin
SOLUTION:
To exclude the dom4j dependency!
To find where dom4j comes.
Exclude the dependency:
And fuck off the "pull-parser".
Add it to the exclusions.
mvn clean install -X -e
PROBLEM:
Caused by: java.lang.NullPointerException
<------>at org.gjt.xpp.sax2.Driver.getIndex(Driver.java:98)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor$AttributesImpl.getIndex(InterningXmlVisitor.java:112)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.XsiNilLoader.selectLoader(XsiNilLoader.java:62)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:53)
<------>at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.startElement(ElementBeanInfoImpl.java:231)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:455)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:433)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137)
<------>at org.gjt.xpp.sax2.Driver.parseSubTree(Driver.java:362)
<------>at org.gjt.xpp.sax2.Driver.parse(Driver.java:310)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
<------>at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
<------>at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
<------>at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.getPlugin(PluginLoader.java:253)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.getPlugin(PluginLoader.java:212)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.loadPlugin(PluginLoader.java:140)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.loadPlugins(PluginLoader.java:115)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.init(PluginLoader.java:84)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.(PluginLoader.java:72)
<------>at org.apache.cxf.tools.wsdlto.core.PluginLoader.getInstance(PluginLoader.java:121)
<------>at org.apache.cxf.tools.wsdlto.WSDLToJava.(WSDLToJava.java:45)
By using the plugin
org.apache.cxf
cxf-codegen-plugin
SOLUTION:
To exclude the dom4j dependency!
mvn dependency:tree > tree.txt
To find where dom4j comes.
Exclude the dependency:
found_dependency
found_dependency
test
dom4j
dom4j
And fuck off the "pull-parser".
Add it to the exclusions.
Thursday, November 19, 2009
Wednesday, November 11, 2009
Monday, September 21, 2009
'jar-no-fork' was specified in an execution, but not found in the plugin
Problem:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 'jar-no-fork' was specified in an execution, but not found in the plugin
Solution:
To install the maven version 2.2.1
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 'jar-no-fork' was specified in an execution, but not found in the plugin
Solution:
To install the maven version 2.2.1
Friday, March 20, 2009
Maven release plugin VS grep + sed
Релиз плагин, релиз плагин, блин!
Вот классная вещь!
grep -rl 2.0.6-SNAPSHOT . | grep -v '.svn' | xargs sed -i -e 's/2.0.6-SNAPSHOT/2.0.6/g'
Вот классная вещь!
grep -rl 2.0.6-SNAPSHOT . | grep -v '.svn' | xargs sed -i -e 's/2.0.6-SNAPSHOT/2.0.6/g'
UPD:
grep -rl 2.0.6-SNAPSHOT . --include=pom.xml | xargs sed -i -e 's/2.0.6-SNAPSHOT/2.0.6/g'
thx Andrew00x
Tuesday, December 9, 2008
Reverse-engineer Source Code into UML Diagrams
Look at the maven pom file at http://svn.exoplatform.org/projects/portlet-container/tags/2.0.12/component/core/pom-with-javadoc-pictures.xml
How to use in maven
org.apache.maven.plugins
maven-javadoc-plugin
org.exoplatform.services.portletcontainer.test
org.umlgraph.doclet.UmlGraphDoc
/home/alexey/java/eXoProjects/portlet-container/trunk/component/core/UmlGraph.jar
-views
Install dependency program:
sudo apt-get install graphviz
Maven command:
mvn site
PACKAGE org.exoplatform.services.portletcontainer.pci
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors

CLASS ActionInput
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors

CLASS Input
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors

http://java.dzone.com/articles/reverse-engineer-source-code-u
It works pretty good!!!
Documentation here
google codesearch ? pom.xml + UmlGraphDoc
google codesearch ? pom.xml + org.umlgraph.doclet.UmlGraphDoc
mvn site
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors
CLASS ActionInput
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors
CLASS Input
1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors
http://java.dzone.com/articles/reverse-engineer-source-code-u
It works pretty good!!!
What Gets Drawn
- -all
- Same as
-attributes-operations-visibility-types-enumerations-enumconstants - -attributes
- Show class attributes (Java fields)
- -commentname
- Name the element using the text in the javadoc comment, instead of the name of its class.
- -constructors
- Show a class's constructors
- -enumconstants
- When showing enumerations, also show the values they can take.
- -enumerations
- Show enumarations as separate stereotyped primitive types.
- -hide
- Specify entities to hide from the graph. Matching is done using a non-anchored regular match. For instance, "
-hide (Big|\.)Widget" would hide "com.foo.widgets.Widget" and "com.foo.widgets.BigWidget". Can also be used without arguments, in this case it will hide everything (useful in the context of views to selectively unhide some portions of the graph, see the view chapter for further details). - -operations
- Show class operations (Java methods)
- -qualify
- Produce fully-qualified class names.
- -types
- Add type information to attributes and operations
- -view
- Specify the fully qualified name of a class that contains a view definition. Only the class diagram specified by this view will be generated.
See the views chapter for more details. - -views
- Generate a class diagram for every view found in the source path.
- -visibility
- Adorn class elements according to their visibility (private, public, protected, package)
Relationship Inference
- -collpackages
- Specify the classes that will be treated as containers for one to many relationships when inference is enabled. Matching is done using a non-anchored regular match. Empty by default.
- -inferdep
- Try to automatically infer dependencies between classes by inspecting methods and fields. See the class diagram inference chapter for more details. Disabled by default.
- -inferdepinpackage
- Enable or disable dependency inference among classes in the same package. This option is disabled by default, because classes in the same package are supposed to be related anyway, and also because there's no working mechanism to actually detect all of these dependencies since imports are not required to use classes in the same package.
- -inferdepvis
- Specifies the lowest visibility level of elements used to infer dependencies among classes. Possible values are private, package, protected, public, in this order. The default value is private. Use higher levels to limit the number of inferred dependencies.
- -inferrel
- Try to automatically infer relationships between classes by inspecting field values. See the class diagram inference chapter for further details. Disabled by default.
- -inferreltype
- The type of relationship inferred when -inferrel is activated. Defaults to "navassoc" (see the class modelling chapter for a list of relationship types).
- -useimports
- Will also use imports to infer dependencies. Disabled by default, since it does not work properly if there are multiple classes in the same source file (will add dependencies to every class in the source file).
google codesearch ? pom.xml + UmlGraphDoc
google codesearch ? pom.xml + org.umlgraph.doclet.UmlGraphDoc
Tuesday, December 2, 2008
Антран плагины: нельзя два в одном и как проверить проперть
Если вы напишете в поме два плагина антран, то будет валидный только второй.
Вот пример:
===\/=====================================
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>000</id>
<phase>clean</phase>
<configuration>
<tasks>
<echo>=== ECHO === [${project.build.directory}] ===</echo>
<echo>=== ECHO === 000 ===</echo>
<echo>=== ECHO === 000 ===</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>0</id>
<phase>clean</phase>
<configuration>
<tasks>
<echo>=== ECHO === [${project.build.directory}] ===</echo>
<echo>=== ECHO === 0 ===</echo>
<echo>=== ECHO === 0 ===</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
===/\=====================================
Результат работы:
[INFO] [clean:clean]
[INFO] [antrun:run {execution: 0}]
[INFO] Executing tasks
[echo] === ECHO === [/home/alexey/java/eXoProjects/portlet-container/trunk/applications/tck-tests/target] ===
[echo] === ECHO === 0 ===
[echo] === ECHO === 0 ===
[INFO] Executed tasks
Кстати, таким образом антран плагином можно проверить наличие системной проперти при помощи ECHO!
Вот пример:
===\/=====================================
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>000</id>
<phase>clean</phase>
<configuration>
<tasks>
<echo>=== ECHO === [${project.build.directory}] ===</echo>
<echo>=== ECHO === 000 ===</echo>
<echo>=== ECHO === 000 ===</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>0</id>
<phase>clean</phase>
<configuration>
<tasks>
<echo>=== ECHO === [${project.build.directory}] ===</echo>
<echo>=== ECHO === 0 ===</echo>
<echo>=== ECHO === 0 ===</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
===/\=====================================
Результат работы:
[INFO] [clean:clean]
[INFO] [antrun:run {execution: 0}]
[INFO] Executing tasks
[echo] === ECHO === [/home/alexey/java/eXoProjects/portlet-container/trunk/applications/tck-tests/target] ===
[echo] === ECHO === 0 ===
[echo] === ECHO === 0 ===
[INFO] Executed tasks
Кстати, таким образом антран плагином можно проверить наличие системной проперти при помощи ECHO!
Thursday, June 12, 2008
Maven war plugin classpath and play around manifest
http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html
Maven 2 build Lifecycle Phases
There are options for dependencies
1. The "optional" tag is "true"
goes in manifest classpath, but not included in WEB-INF/lib
2. The "scope" tag is "provided"
excluded from manifest classpath, and excluded from WEB-INF/lib
For plugin maven-war-plugin we can add options to exclude all dependencies in manifest.
How can we exclude a list of dependencies from MANIFEST file with some option for plugin configuration?
E.g.:
Maven 2 build Lifecycle Phases
There are options for dependencies
1. The "optional" tag is "true"
goes in manifest classpath, but not included in WEB-INF/lib
2. The "scope" tag is "provided"
excluded from manifest classpath, and excluded from WEB-INF/lib
For plugin maven-war-plugin we can add options to exclude all dependencies in manifest.
configuration
archive
manifest
addClasspath false /addClasspath
How can we exclude a list of dependencies from MANIFEST file with some option for plugin configuration?
E.g.:
configuration
excludeProjects
junit, jmock, bcel, ehcache, xercesImpl
/excludeProjects
includeToWarClasspath/
/configuration
Thursday, October 4, 2007
Maven for Eclipse
About maven on my blog
Install maven
Download direct link (tar.gz ver. 2.0.7)
Unpack it by:
tar xzfv maven-2.0.7-bin.tar.gz
Configure Maven
In your home directory within .profile file add lines with changes according your path:
export MAVEN_HOME=/home/alexey/java/maven2
export PATH=$MAVEN_HOME/bin:$PATH
Configure Eclipse
Window -> Preferences ->
Java -> Build Path -> Classpath Variables
Set new:
Name "M2_REPO"
Path "/home/alexey/java/maven2/repository"
Run maven on Eclipse
Run -> Open Run Dialog ... ->
Double Click on "Java Application"
1. Main
Enter Name, choose project for build, insert main class "org.codehaus.classworlds.Launcher"

2. Arguments
Program arguments: "clean install"
VM arguments, modify with your situation:
-Xmx300m
-cp "/home/alexey/java/maven2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"
-Dclassworlds.conf="/home/alexey/java/maven2/bin/m2.conf"
-Dmaven.home="/home/alexey/java/maven2"
-Dtest.repository=db1

3. Classpath
Add to the "User entries" classworlds-1.1-alpha-2.jar by click "Add External JARs ..."
e.g.: from repository/classworlds/1.1-alpha-2/
Have you seen this error?
========================
[INFO] [antrun:run {execution: 1}]
[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: taskdef A class needed by class xdoclet.modules.hibernate.HibernateDocletTask cannot be found: org/apache/tools/ant/DynamicConfigurator
========================
Than add to "Bootstrap Entries" the ant jar "ant-_._._.jar"
e.g.: from repository/ant/ant/1.6.5/ant-1.6.5.jar
Apply and Run
Install maven
Download direct link (tar.gz ver. 2.0.7)
Unpack it by:
tar xzfv maven-2.0.7-bin.tar.gz
Configure Maven
In your home directory within .profile file add lines with changes according your path:
export MAVEN_HOME=/home/alexey/java/maven2
export PATH=$MAVEN_HOME/bin:$PATH
Configure Eclipse
Window -> Preferences ->
Java -> Build Path -> Classpath Variables
Set new:
Name "M2_REPO"
Path "/home/alexey/java/maven2/repository"
Run maven on Eclipse
Run -> Open Run Dialog ... ->
Double Click on "Java Application"
1. Main
Enter Name, choose project for build, insert main class "org.codehaus.classworlds.Launcher"

2. Arguments
Program arguments: "clean install"
VM arguments, modify with your situation:
-Xmx300m
-cp "/home/alexey/java/maven2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"
-Dclassworlds.conf="/home/alexey/java/maven2/bin/m2.conf"
-Dmaven.home="/home/alexey/java/maven2"
-Dtest.repository=db1

3. Classpath
Add to the "User entries" classworlds-1.1-alpha-2.jar by click "Add External JARs ..."
e.g.: from repository/classworlds/1.1-alpha-2/
Have you seen this error?========================
[INFO] [antrun:run {execution: 1}]
[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: taskdef A class needed by class xdoclet.modules.hibernate.HibernateDocletTask cannot be found: org/apache/tools/ant/DynamicConfigurator
========================
Than add to "Bootstrap Entries" the ant jar "ant-_._._.jar"
e.g.: from repository/ant/ant/1.6.5/ant-1.6.5.jar
Apply and Run
Friday, July 6, 2007
Maven and Continuum
Maven 2
official and wiki

Dowload page
Download direct link (tar.gz ver. 2.0.7)
REPOSITORY:
http://mirrors.ibiblio.org/pub/mirrors/maven2/
mvn clean install
-Dmaven.test.skip=true
-Dxfire.java5=true
Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
We faced problem with antrun plugin
[INFO] [antrun:run {execution: 0}]
[INFO] Executing tasks
[mkdir] Created dir:
D:\exo\projects\projects\portlet-container\branches\2.0\component\plugins\wsrp1\target\generate
d
[java] java.lang.NoClassDefFoundError: org/apache/axis/wsdl/WSDL2Java
[java] Exception in thread "main"
[java] Java Result: 1
Thats problem solved with change
<latest>1.0</latest>
<release>1.0</release>
within
maven2\repository\org\apache\maven\plugins\maven-antrun-plugin\maven-metadata-central.xml
Or, much better to point version for maven plugin within pom.xml
For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Links:
Maven
Documentation
Configuring Maven
Introduction to the POM
POM Reference
SETTINGS Reference
Introduction to the lifecycle
Build Lifecycle Phases
Frequently Asked Technical Questions
The APT format
Download Maven (latest version 2.0.5)
THE BEST MAVEN ARTICLE POST EVER!
Continuum
wiki

Continuum is a continous integration server for building Java based projects.
Continuum is a great partner to Apache Maven which will run builds on a configurable schedule. Continuum will email developers when the build is broken requesting that the culprit fix the problem. You may add a project to Continuum simply by pointing to the pom.xml in the source control system and it will magically do the rest (check out from source control, run a clean build, deploy to the integration server and run unit tests).
Links:
Welcome to Continuum
Documentation
About Continuum
Download Continuum (latest version 1.0.3)
official and wiki
Dowload page
Download direct link (tar.gz ver. 2.0.7)
REPOSITORY:
http://mirrors.ibiblio.org/pub/mirrors/maven2/
mvn clean install
-Dmaven.test.skip=true
-Dxfire.java5=true
Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
We faced problem with antrun plugin
[INFO] [antrun:run {execution: 0}]
[INFO] Executing tasks
[mkdir] Created dir:
D:\exo\projects\projects
d
[java] java.lang.NoClassDefFoundError: org/apache/axis/wsdl/WSDL2Java
[java] Exception in thread "main"
[java] Java Result: 1
Thats problem solved with change
<latest>1.0</latest>
<release>1.0</release>
within
maven2\repository\org\apache
Or, much better to point version for maven plugin within pom.xml
For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.0</version>
And, sometimes ploblem in that maven doesn't see plugins at all.
Need to point plugin repository
For example:
<pluginRepositories>
<pluginRepository>
<id>snapshot</id>
<name>Snapshot repository</name>
<url>http://snapshots.maven.codehaus.org/maven2/ </url>
</pluginRepository>
</pluginRepositories>
And, sometimes ploblem in that maven doesn't see plugins at all.
Need to point plugin repository
For example:
<pluginRepositories>
<pluginRepository>
<id>snapshot</id>
<name>Snapshot repository</name>
<url>http://snapshots.maven.codehau
</pluginRepository>
</pluginRepositories>
Links:
Maven
Documentation
Configuring Maven
Introduction to the POM
POM Reference
SETTINGS Reference
Introduction to the lifecycle
Build Lifecycle Phases
Frequently Asked Technical Questions
The APT format
Download Maven (latest version 2.0.5)
THE BEST MAVEN ARTICLE POST EVER!
Continuum
wiki
Continuum is a continous integration server for building Java based projects.
Continuum is a great partner to Apache Maven which will run builds on a configurable schedule. Continuum will email developers when the build is broken requesting that the culprit fix the problem. You may add a project to Continuum simply by pointing to the pom.xml in the source control system and it will magically do the rest (check out from source control, run a clean build, deploy to the integration server and run unit tests).
Links:
Welcome to Continuum
Documentation
About Continuum
Download Continuum (latest version 1.0.3)
Subscribe to:
Posts (Atom)



