Raster layer - Geotools: java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO - maven

Here is what i got back when i run the mvn command regarding the dependencies. The main problem as i explained before is that the imageIO lib is not working when i am trying to run the jar file outside IDE. I would like to point out that all the other functionalities are working properly. Do you have any idea of how to solve this problem? I have also try to follow the steps in this link: http://docs.geotools.org/latest/userguide/build/install/jdk.html but i got back the same error.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gisLaraMaven gis
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.geotools:gt-wfs:jar:20.1 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) # gis ---
[INFO]
[INFO] The following files have been resolved:
[INFO] com.conversantmedia:disruptor:jar:1.2.13:compile
[INFO] com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] com.google.errorprone:error_prone_annotations:jar:2.2.0:compile
[INFO] com.google.guava:failureaccess:jar:1.0:compile
[INFO] com.google.guava:guava:jar:27.0-jre:compile
[INFO] com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] com.miglayout:miglayout:jar:swing:3.7:compile
[INFO] com.vividsolutions:jts:jar:1.13:compile
[INFO] commons-codec:commons-codec:jar:1.2:compile
[INFO] commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] commons-io:commons-io:jar:2.6:compile
[INFO] commons-logging:commons-logging:jar:1.0.4:compile
[INFO] commons-pool:commons-pool:jar:1.5.4:compile
[INFO] hsqldb:hsqldb:jar:1.8.0.7:compile
[INFO] it.geosolutions.imageio-ext:imageio-ext-geocore:jar:1.1.27:compile
[INFO] it.geosolutions.imageio-ext:imageio-ext-streams:jar:1.1.27:compile
[INFO] it.geosolutions.imageio-ext:imageio-ext-tiff:jar:1.1.27:compile
[INFO] it.geosolutions.imageio-ext:imageio-ext-utilities:jar:1.1.27:compile
[INFO] it.geosolutions.jaiext.affine:jt-affine:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.algebra:jt-algebra:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.bandcombine:jt-bandcombine:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.bandmerge:jt-bandmerge:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.bandselect:jt-bandselect:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.binarize:jt-binarize:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.border:jt-border:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.buffer:jt-buffer:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.classifier:jt-classifier:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.colorconvert:jt-colorconvert:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.colorindexer:jt-colorindexer:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.crop:jt-crop:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.errordiffusion:jt-errordiffusion:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.format:jt-format:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.imagefunction:jt-imagefunction:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.iterators:jt-iterators:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.lookup:jt-lookup:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.mosaic:jt-mosaic:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.nullop:jt-nullop:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.orderdither:jt-orderdither:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.piecewise:jt-piecewise:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.rescale:jt-rescale:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.rlookup:jt-rlookup:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.scale:jt-scale:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.scale2:jt-scale2:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.shadedrelief:jt-shadedrelief:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.stats:jt-stats:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.translate:jt-translate:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.utilities:jt-utilities:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.vectorbin:jt-vectorbin:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.warp:jt-warp:jar:1.1.3:compile
[INFO] it.geosolutions.jaiext.zonal:jt-zonal:jar:1.1.3:compile
[INFO] javax.measure:unit-api:jar:1.0:compile
[INFO] javax.media:jai_codec:jar:1.1.3:compile
[INFO] javax.media:jai_core:jar:1.1.3:compile
[INFO] javax.media:jai_imageio:jar:1.1:compile
[INFO] jgridshift:jgridshift:jar:1.0:compile
[INFO] junit:junit:jar:3.8.1:test
[INFO] net.sf.geographiclib:GeographicLib-Java:jar:1.49:compile
[INFO] org.apache.xml:xml-commons-resolver:jar:1.2:compile
[INFO] org.checkerframework:checker-qual:jar:2.5.2:compile
[INFO] org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] org.ejml:ejml-core:jar:0.34:compile
[INFO] org.ejml:ejml-ddense:jar:0.34:compile
[INFO] org.geotools:gt-api:jar:20.1:compile
[INFO] org.geotools:gt-coverage:jar:20.1:compile
[INFO] org.geotools:gt-cql:jar:20.1:compile
[INFO] org.geotools:gt-data:jar:20.1:compile
[INFO] org.geotools:gt-epsg-hsql:jar:20.1:compile
[INFO] org.geotools:gt-geotiff:jar:20.1:compile
[INFO] org.geotools:gt-image:jar:20.1:compile
[INFO] org.geotools:gt-main:jar:20.1:compile
[INFO] org.geotools:gt-metadata:jar:20.1:compile
[INFO] org.geotools:gt-opengis:jar:20.1:compile
[INFO] org.geotools:gt-process:jar:20.1:compile
[INFO] org.geotools:gt-referencing:jar:20.1:compile
[INFO] org.geotools:gt-render:jar:20.1:compile
[INFO] org.geotools:gt-shapefile:jar:20.1:compile
[INFO] org.geotools:gt-swing:jar:20.1:compile
[INFO] org.geotools:gt-wfs:jar:20.1:compile
[INFO] org.geotools:gt-wms:jar:20.1:compile
[INFO] org.geotools:gt-xml:jar:20.1:compile
[INFO] org.hsqldb:hsqldb:jar:2.4.1:compile
[INFO] org.jaitools:jt-utils:jar:1.5.0:compile
[INFO] org.jaitools:jt-zonalstats:jar:1.5.0:compile
[INFO] org.jdom:jdom2:jar:2.0.6:compile
[INFO] org.locationtech.jts:jts-core:jar:1.16.0:compile
[INFO] org.postgresql:postgresql:jar:9.4-1202-jdbc42:compile
[INFO] org.slf4j:slf4j-api:jar:1.7.13:compile
[INFO] si.uom:si-quantity:jar:0.7.1:compile
[INFO] si.uom:si-units-java8:jar:0.7.1:compile
[INFO] systems.uom:systems-common-java8:jar:0.7.2:compile
[INFO] tec.uom:uom-se:jar:1.0.8:compile
[INFO] tec.uom.lib:uom-lib-common:jar:1.0.2:compile
[INFO] xerces:xercesImpl:jar:2.11.0:compile
[INFO] xml-apis:xml-apis:jar:1.4.01:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.701s
[INFO] Finished at: Wed Apr 03 18:37:35 EEST 2019
[INFO] Final Memory: 12M/243M
[INFO] ------------------------------------------------------------------------
And here is the part of the pom.xml which is the maven shade plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- This bit sets the main class for
the executable jar as you otherwise -->
<!-- would with the assembly plugin
-->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.mycompany.gislaramaven.gisMap_3</Main-Class>
</manifestEntries>
</transformer>
<!-- This bit merges the various
GeoTools META-INF/services files -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Specification-Vendor>Sun Microsystems, Inc</Specification-Vendor>
<Implementation-Vendor>Sun Microsystems, Inc</Implementation-Vendor>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
The new error that i am getting back is given below. It seems that again something is missing related to the JAI lib. Please have a look:
WARNING The input argument(s) may not be null.
java.lang.IllegalArgumentException: The input argument(s) may not be null.
at javax.media.jai.ParameterBlockJAI.getDefaultMode(ParameterBlockJAI.java:136)
at javax.media.jai.ParameterBlockJAI.<init>(ParameterBlockJAI.java:157)
at javax.media.jai.ParameterBlockJAI.<init>(ParameterBlockJAI.java:178)
at it.geosolutions.jaiext.vectorbin.ROIGeometry.getAsImage(ROIGeometry.java:473)
at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.addRoiIfMissing(GridCoverageRenderer.java:1095)
at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.reproject(GridCoverageRenderer.java:509)
at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.renderImage(GridCoverageRenderer.java:958)
at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.paint(GridCoverageRenderer.java:1279)
at org.geotools.renderer.lite.StreamingRenderer$RenderCoverageReaderRequest.execute(StreamingRenderer.java:3650)
at org.geotools.renderer.lite.StreamingRenderer$PainterThread.run(StreamingRenderer.java:3744)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

You need to add ImageIO to your manifestEntries using something like:
<transformers>
<!-- This bit sets the main class for the executable jar as you otherwise -->
<!-- would with the assembly plugin -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.ianturton.tileviewer.TileViewer</Main-Class>
<Specification-Title> Java Advanced Imaging Image I/O Tools</Specification-Title>
<Specification-Version>1.1</Specification-Version>
<Specification-Vendor> Sun Microsystems, Inc. </Specification-Vendor>
<Implementation-Title> com.sun.media.imageio</Implementation-Title>
<Implementation-Version> 1.1</Implementation-Version>
<Implementation-Vendor> Sun Microsystems, Inc.</Implementation-Vendor>
</manifestEntries>
</transformer>
<!-- This bit merges the various GeoTools META-INF/services files -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>

You probably have not build a fat jar.
If you just build a jar, dependencies are not included, so running the jar outside the IDE will usually result in missing classes.
You can use the maven assembly plugin or maven shade plugin to generate a fat jar.

Related

maven doesn't package the compiled source files

I have the following in my pom.xml
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The only classes found in the 0.0.1-SNAPSHOT.jar are from
org.springframework.boot.loader package. None of the class files
compiled from my source files is there. Below is the output of maven
install:
INFO] --------------------< com.stocktrader:stock-trader
-------------------- [INFO] Building stock-trader 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar
]--------------------------------- [INFO] [INFO] ---
build-helper-maven-plugin:3.0.0:add-source (default) # stock-trader
--- [INFO] Source directory: C:\Users\kannanj\IdeaProjects\ibkr\src\main\java added. [INFO] [INFO]
--- maven-resources-plugin:3.2.0:resources (default-resources) # stock-trader --- [INFO] Using 'UTF-8' encoding to copy filtered
resources. [INFO] Using 'UTF-8' encoding to copy filtered properties
files. [INFO] Copying 1 resource [INFO] Copying 3 resources [INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) #
stock-trader --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-resources-plugin:3.2.0:testResources
(default-testResources) # stock-trader --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to
copy filtered properties files. [INFO] skip non existing
resourceDirectory
C:\Users\kannanj\IdeaProjects\ibkr\src\test\resources [INFO] [INFO]
--- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) # stock-trader --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test
(default-test) # stock-trader --- [INFO] Tests are skipped. [INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) # stock-trader ---
[INFO] Building jar:
C:\Users\kannanj\IdeaProjects\ibkr\target\stock-trader-0.0.1-SNAPSHOT.jar
[INFO] [INFO] --- spring-boot-maven-plugin:2.7.0:repackage
(repackage) # stock-trader --- [INFO] Replacing main artifact with
repackaged archive [INFO] [INFO] ---
maven-install-plugin:2.5.2:install (default-install) # stock-trader
--- [INFO] Installing C:\Users\kannanj\IdeaProjects\ibkr\target\stock-trader-0.0.1-SNAPSHOT.jar
to
C:\Users\kannanj.m2\repository\com\stocktrader\stock-trader\0.0.1-SNAPSHOT\stock-trader-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\kannanj\IdeaProjects\ibkr\pom.xml to
C:\Users\kannanj.m2\repository\com\stocktrader\stock-trader\0.0.1-SNAPSHOT\stock-trader-0.0.1-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS
Please help before I shoot myself.
If you want to use some common parts in another project there are two possible solutions.
First make a multi module build and separate the common from the other parts. The commons part will be a simple jar (also possible with some spring support)
Create a complete separate standalone project and consume that.

Maven 2 & 3 differences on dependency:analyze with cycle

Here's the dependency tree I'm using:
[INFO] ------------------------------------------------------------------------
[INFO] Building PA 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # PA ---
[INFO] myTest:PA:jar:0.0.2-SNAPSHOT
[INFO] \- PC:PC:jar:0.0.1-SNAPSHOT:compile
[INFO] \- myTest:PA:jar:0.0.1-SNAPSHOT:compile
As you can see, there's a cycle :
PA > PC > PA
Using maven 2.2.1:
mvn dependency:analyze
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - myTest:PA:jar:0.0.2-SNAPSHOT
[INFO] task-segment: [dependency:analyze]
[INFO] ------------------------------------------------------------------------
...
[INFO] No dependency problems found
Using maven 3.3.3:
mvn dependency:analyze
[INFO] ------------------------------------------------------------------------
[INFO] Building PA 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) # PA ---
[WARNING] Used undeclared dependencies found:
[WARNING] myTest:PA:jar:0.0.1-SNAPSHOT:compile
The analyze using maven 3 wants me to add PA as a dependency to PA, to itself. Is it possible to have the same behavior as maven 2 using maven 3?
Here's the workaround I'm using to have the same result as Maven 2 using Maven 3:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<ignoredDependencies>
<ignoredDependencie>${project.groupId}:${project.artifactId}::</ignoredDependencie>
</ignoredDependencies>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

Maven is not downloading a plugin : jetspeed-unpack-maven-plugin

so I made this pom :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mssb.ocr</groupId>
<artifactId>tesseractOcr</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<!-- autorun unit tests during maven compilation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m -XX:-UseSplitVerifier</argLine>
<skipTests>-DskipTests</skipTests>
</configuration>
</plugin>
<!--
this extract the 32 bits dll and the tesseractdata folder to
the project root from tess4j.jar
-->
<plugin>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-unpack-maven-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<unpack>
<artifact>net.sourceforge.tess4j:tess4j:jar</artifact>
<overwrite>true</overwrite>
<resources combine.children="append">
<resource>
<path>win32-x86</path>
<destination>${basedir}</destination>
<overwrite>true</overwrite>
<flat>true</flat>
<include>*</include>
</resource>
<resource>
<path>tessdata</path>
<destination>${basedir}</destination>
<overwrite>true</overwrite>
<flat>false</flat>
<include>*</include>
</resource>
</resources>
</unpack>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--
Log4j 2 is broken up in an API and an implementation (core), where the API
provides the interface that applications should code to. Strictly speaking
Log4j core is only needed at runtime and not at compile time.
However, below we list Log4j core as a compile time dependency to improve
the startup time for custom plugins.
-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.1</version>
</dependency>
<!--
Integration of tesseract OCR
-->
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mvn clean install and eclipse:eclipse both end up in a "SUCCESS" however the jeetspeed plugin does nothing, I don't see him doing anything in the console when building and he his not even in my local repository.
Yes, I added maven central to my maven conf file (http://repo1.maven.org/maven2/)
I'm using maven 3.2.1
What could I do?
Thanks
EDIT
mvn clean install
D:\!2015 repo\TTsXXJava>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] capcha solver
[INFO] tesseract ocr project
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building capcha solver 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # parent ---
[INFO] Deleting D:\!2015 repo\TTsXXJava\target
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # parent ---
[INFO] Installing D:\!2015 repo\TTsXXJava\pom.xml to d:\.m2\fr\mssb\capcha\parent\1.0\parent-1.0.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tesseract ocr project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # tesseractOcr ---
[INFO] Deleting D:\!2015 repo\TTsXXJava\capcha-solver\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # tesseractOcr ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # tesseractOcr ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\!2015 repo\TTsXXJava\capcha-solver\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # tesseractOcr ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # tesseractOcr ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # tesseractOcr ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # tesseractOcr ---
[INFO] Building jar: D:\!2015 repo\TTsXXJava\capcha-solver\target\tesseractOcr-1.0.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # tesseractOcr ---
[INFO] Installing D:\!2015 repo\TTsXXJava\capcha-solver\target\tesseractOcr-1.0.jar to d:\.m2\fr\mssb\capcha\tesseractOcr\1.0\tesseractOcr-1.0.jar
[INFO] Installing D:\!2015 repo\TTsXXJava\capcha-solver\pom.xml to d:\.m2\fr\mssb\capcha\tesseractOcr\1.0\tesseractOcr-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] capcha solver ..................................... SUCCESS [ 0.381 s]
[INFO] tesseract ocr project ............................. SUCCESS [ 1.910 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.424 s
[INFO] Finished at: 2015-02-05T12:52:22+01:00
[INFO] Final Memory: 14M/231M
[INFO] ------------------------------------------------------------------------
mvn eclipse:eclipse
$ mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] capcha solver
[INFO] tesseract ocr project
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building capcha solver 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent ---
[INFO] Not running eclipse plugin goal for pom project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tesseract ocr project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr ---
[INFO] Using as WTP server : null
[INFO] Using source status cache: D:\!2015 repo\TTsXXJava\target\mvn-eclipse-cache.properties
[INFO] File D:\!2015 repo\TTsXXJava\capcha-solver\.project already exists.
Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
[INFO] Wrote Eclipse project for "tesseractOcr" to D:\!2015 repo\TTsXXJava\capcha-solver.
[INFO]
Javadoc for some artifacts is not available.
List of artifacts without a javadoc archive:
o com.sun.jna:jna:3.0.9
o net.java.dev.jai-imageio:jai-imageio-core-standalone:1.2-pre-dr-b04-2011-07-04
o log4j:log4j:1.2.15
o commons-io:commons-io:1.3.1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] capcha solver ..................................... SUCCESS [ 0.962 s]
[INFO] tesseract ocr project ............................. SUCCESS [ 0.406 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.698 s
[INFO] Finished at: 2015-02-05T12:42:36+01:00
[INFO] Final Memory: 7M/183M
[INFO] ------------------------------------------------------------------------
Parent pom in case you need it (I remove the parent reference in the originaly posted pom)
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mssb.capcha</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>capcha solver</name>
<modules>
<module>capcha-solver</module>
</modules>
<build>
<plugins>
<!-- All project will be interpreted (source) and compiled (target) in java 7 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- this will make eclipse:eclipse goal work and make the project Eclipse compatible -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7</classpathContainer>
</classpathContainers>
<additionalBuildcommands>
<buildcommand>net.sf.eclipsecs.core.CheckstyleBuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>net.sf.eclipsecs.core.CheckstyleNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
It is not doing anything because you have not bound any execution of the plugin to a lifecycle phase. You need to add a block like this:
<plugin>
<executions>
<execution>
<id>unpack-step</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
...
</configuration>
</executions>
</plugin>
See http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference for the possible lifecycle phases you can use.

capture maven wagon:exist output

is there a way to capture the output of the maven wagon:exist goal?
if i configure:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-5</version>
<executions>
<execution>
<id>check</id>
<phase>validate</phase>
<goals>
<goal>exist</goal>
</goals>
<configuration>
<serverId>tst.check</serverId>
<url>https://tst.check/${url.part}</url>
</configuration>
</execution>
</executions>
</plugin>
then run the build with a existing url:
c:\dev\tst.package>mvn validate -Durl.part=valid
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tst.package 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wagon-maven-plugin:1.0-beta-5:exist (check) # tst.package ---
[INFO] exists.
and if i run the build with an invalid url:
c:\dev\tst.package>mvn validate -Durl.part=invalid
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tst.package 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wagon-maven-plugin:1.0-beta-5:exist (check) # tst.package ---
[INFO] does not exists.
i want to capture the output because i have to process different further steps if the url is valid or not. i am using the wagon plugin because the maven-antrun-plugin don't consider the configured user & password for this server in the settings.xml file.
The source code for the mojo does exactly what you've already shown: log a message if the resource exists or doesn't. I don't see a way to capture the output of the wagon:exist goal.

maven-invoker doesn't call install on dependency

i have a problem in my maven build process. there is a pom file which uses the maven-invoker-plugin to execute different tasks:
<execution>
<id>createWebstartApps</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<projectsDirectory>.</projectsDirectory>
<streamLogs>true</streamLogs>
<pomIncludes>
<pomInclude>pom1.xml</pomInclude>
</pomIncludes>
....
but when i use the maven release plugin "mvn release:prepare" the install goal will not be executed on the child pom dependencies. For example the pom1.xml has the following dependency:
<dependency>
<groupId>com.qnamic.dis</groupId>
<artifactId>DisAdminToolWithPlugins</artifactId>
<version>${project.parent.version}</version>
<type>pom</type>
<scope>runtime</scope>
.....
But this dependency (in this case the pom file) will not be installed in my local maven repo and therefore not be found:
[INFO] [INFO] Building: pomWebstartDisAdminTool.xml
[INFO] [INFO] [INFO] Scanning for projects...
[INFO] [INFO] [INFO]
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] Building RailOpt DIS Admin Tool 4.9.12
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [WARNING] The POM for com.qnamic.dis:DisAdminToolWithPlugins:pom:4.9.12 is missing, no dependency information available
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] BUILD FAILURE
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] Total time: 0.203s
[INFO] [INFO] [INFO] Finished at: Tue Feb 05 13:00:04 CET 2013
[INFO] [INFO] [INFO] Final Memory: 4M/15M
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [ERROR] Failed to execute goal on project DisAdminToolWebstart: Could not resolve dependencies for project com.qnamic.dis:DisAdminToolWebstart:pom:4.9.12: Failure to find com.qnamic.dis:DisAdminToolWithPlugins:pom:4.9.12 in http://maven.ad.bls.ch/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of bls-public has elapsed or updates are forced -> [Help 1]
any ideas?
regards
Try adding install before run. Eg.
<execution>
<id>createWebstartApps</id>
<phase>process-resources</phase>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
...
For more information: http://maven.apache.org/plugins/maven-invoker-plugin/install-mojo.html & http://maven.apache.org/plugins/maven-invoker-plugin/usage.html
HTH,
Jamie
Add the file invoker.properties next to your pom.xml
and put your goals into it, like:
invoker.goals = clean install

Resources