Trying to setup JPOS Q2 for the first time through Maven / Intellij, and coming across an error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/BundleException
at Q2_Main.main(Q2_Main.java:6)
Caused by: java.lang.ClassNotFoundException: org.osgi.framework.BundleException
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 1 more
Process finished with exit code 1
I downloaded JPOS through maven, and I've tried looking at dozens of threads on the error but cannot resolve it on my own
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Q2_JPOS_TEST</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.jpos</groupId>
<artifactId>jpos</artifactId>
<version>2.1.6</version>
</dependency>
</dependencies>
</project>
and I see it in my external libraries
jpos in external library
import org.jpos.q2.Q2;
public class Q2_Main {
public static void main(String[] args){
Q2 q2 = new Q2("src/main/java/deploy");
q2.start();
}
}
Edit for steps that I did:
File -> New Project -> Maven Project (created the POM automatically)
Pasted the JPOS dependency from my main project into new POM file
Maven Clean + Install from within Intellij Maven Panel
Created Q2_Main.java
Hit green play button, which results in that error
Edit 2:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< org.example:Q2_JPOS_TEST >------------
[INFO] Building Q2_JPOS_TEST 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]-----------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) #
Q2_JPOS_TEST ---
[INFO] org.example:Q2_JPOS_TEST:jar:1.0-SNAPSHOT
[INFO] \- org.jpos:jpos:jar:2.1.6:compile
[INFO] +- commons-cli:commons-cli:jar:1.4:compile
[INFO] +- org.apache-extras.beanshell:bsh:jar:2.0b6:compile
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.67:compile
[INFO] +- org.bouncycastle:bcpg-jdk15on:jar:1.67:compile
[INFO] +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] +- org.javatuples:javatuples:jar:1.2:compile
[INFO] +- org.jdom:jdom2:jar:2.0.6:compile
[INFO] +- org.jline:jline:jar:3.19.0:compile
[INFO] \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] --------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------
[INFO] Total time: 2.205 s
[INFO] Finished at: 2023-02-17T15:43:38-07:00
[INFO] --------------------------------------------------------------
I checked on the maven repository the library you are trying to use, jpos 2.1.6 (https://mvnrepository.com/artifact/org.jpos/jpos/2.1.6), and I've seen it has a series of runtime dependencies. It seems you miss org.osgi.core 6.0.0 judging from the stacktrace you posted. Make sure you have all the runtime dependencies needed in your classpath.
Here is a step by step of what I did to tun your code:
Create an empty folder /tmp/test-jpos
Write the file pom.xml there with the content you shared.
In IntelliJ menu File -> Open and opened the /tmp/test-jpos folder
Create dir src/main/java
Create file Q2_Main.java in that directory with content you shared.
Run the project by hitting the play run button (the green triangle)
With those steps it ran OK.
However that is not the recommended way to run Q2 I will expand on this later.
Related
This question already has answers here:
Maven: lifecycle phase to run a program?
(2 answers)
Closed 2 years ago.
Looking to run a basic console app with maven:
nicholas#mordor:~/NetBeansProjects/mavenchimp$
nicholas#mordor:~/NetBeansProjects/mavenchimp$ mvn clean exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< tech.saundersconsulting:mavenchimp >-----------------
[INFO] Building mavenchimp 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mavenchimp ---
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) # mavenchimp ---
[WARNING]
java.lang.ClassNotFoundException: tech.mavenchimp.App
at java.net.URLClassLoader.findClass (URLClassLoader.java:471)
at java.lang.ClassLoader.loadClass (ClassLoader.java:589)
at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:246)
at java.lang.Thread.run (Thread.java:834)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.465 s
[INFO] Finished at: 2020-12-06T08:06:26-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project mavenchimp: An exception occured while executing the Java class. tech.mavenchimp.App -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
directory tree
nicholas#mordor:~/NetBeansProjects/mavenchimp$ tree
.
├── pom.xml
└── src
├── main
│ └── java
│ └── tech
│ └── mavenchimp
│ ├── App.java
│ └── Chimp.java
└── test
└── java
7 directories, 3 files
the pom
nicholas#mordor:~/NetBeansProjects/mavenchimp$ cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tech.saundersconsulting</groupId>
<artifactId>mavenchimp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<exec.mainClass>tech.mavenchimp.App</exec.mainClass>
</properties>
</project>
the code
nicholas#mordor:~/NetBeansProjects/mavenchimp$ cat src/main/java/tech/mavenchimp/App.java
package tech.mavenchimp;
import java.util.logging.Logger;
public class App {
private static final Logger log = Logger.getLogger(App.class.getName());
private void runApp() {
log.info("running..");
Chimp chimp = new Chimp();
chimp.connect();
}
public static void main(String[] args) {
new App().runApp();
}
}
nicholas#mordor:~/NetBeansProjects/mavenchimp$
where the pom.xml was generated by Netbeans and I simply added the line:
<exec.mainClass>tech.mavenchimp.App</exec.mainClass>
in order to be able to run the exec command with maven.
Running maven with the -e swith gives:
Caused by: java.lang.ClassNotFoundException: tech.mavenchimp.App
how is that class specified beyond the setting in the pom.xml as above?
Solution:
nicholas#mordor:~/NetBeansProjects/mavenchimp$
nicholas#mordor:~/NetBeansProjects/mavenchimp$ mvn clean compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< tech.saundersconsulting:mavenchimp >-----------------
[INFO] Building mavenchimp 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mavenchimp ---
[INFO] Deleting /home/nicholas/NetBeansProjects/mavenchimp/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # mavenchimp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/nicholas/NetBeansProjects/mavenchimp/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # mavenchimp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/nicholas/NetBeansProjects/mavenchimp/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) # mavenchimp ---
Dec 06, 2020 8:17:54 AM tech.mavenchimp.App runApp
INFO: running..
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.739 s
[INFO] Finished at: 2020-12-06T08:17:54-08:00
[INFO] ------------------------------------------------------------------------
nicholas#mordor:~/NetBeansProjects/mavenchimp$
Wouldn't exec depend on compile?
I have a maven project with a following directory structure:
trunk
| pom.xml
| coreutils
| | pom.xml
| | src
| budgetCap
| | pom.xml
| | src
The content of trunk/pom.xml is :
<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
hxttp://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Ant2Maven</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Parent Pom</name>
<modules>
<module>coreutils</module>
<module>budgetCap</module>
</modules>
In this structure, "budgetCap" is dependent on "coreutils",i.e. pom.xml of "budgetCap" contains a dependency of "coreutils"
Now I have two methods to build this project
First Method
Aggregation using Reactor
I will be inside trunk
So first of all I do mvn clean
shakim:trunk shakim.md$ mvn clean
Maven deletes the target folder of the two module in this order:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] coreutils
[INFO] budgetCap Maven Webapp
[INFO] Parent Pom
Now when i do mvn install
shakim:trunk shakim.md$ mvn install
Maven starts building modules in the following order:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] coreutils
[INFO] budgetCap Maven Webapp
[INFO] Parent Pom
In the given order, coreutils gets installed in the local repository successfully.
But budgetCap fails at the compilation giving an error that maven is unable to locate a class which was supposed to be produced by coreutils
the error message is as follows:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building budgetCap Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # budgetCap ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # budgetCap ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 65 source files to /Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING]/Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/core/SingletonAggregator.java: /Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/core/SingletonAggregator.java uses unchecked or unsafe operations.
[WARNING]/Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/core/SingletonAggregator.java: Recompile with -Xlint:unchecked for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/core/BudgetCapServer.java:[41,34] package com.adiquity.request.utils does not exist
[ERROR] /Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/utils/Utils.java:[9,34] package com.adiquity.request.utils does not exist
[ERROR] /Users/shakim.md/shakim/maven/ops/adq_services/trunk/budgetCap/src/main/java/com/adiquity/budgetCap/log/data/parser/ConversionParser.java:[16,34] package com.adiquity.request.utils does not exist
Briefly speaking this package package com.adiquity.request.utils is actually present in coreutils, which this module budgetCap must have located successfully, but it is not.
Second Method
Go inside coreutils and do a
shakim:coreutils shakim.md$ mvn clean install
Go inside budgetCap and do a
shakim:budgetCap shakim.md$ mvn clean install
budgetCap compiles successfully without reporting any kind of error.
My question is that I want to use Reactors in Maven and I am unable to figure out why the build fails on using 1st method whereas 2nd method of building completes smoothly??
I am not sure how to use reactors, do we need to include anything in pom of coreutils and budgetCap signifying that pom of trunk is the parent.
Note: I don't want to use inheritance in this project
Good Morning.
I am using maven release-plugin in a MultiModule Project.
Though mvn release:prepare and mvn release:perform are SUCCESSFUL why do I see "SKIPPED" for child maven modules when I run mvn release:prepare.
Please help me.
My codebase folder structure is as follows:
PARENT
##############
c:\projects\MavenRightMultiModuleParent\pom.xml
c:\projects\MavenRightMultiModuleParent\src\main\java
c:\projects\MavenRightMultiModuleParent\src\test\java
Parent POM.xml have below as <MODULES><MODULEchild1webapp></MODULE>......</MODULES>
CHILD MODULES
###################
c:\projects\MavenRightMultiModuleParent\child1webapp\pom.xml
.....
c:\projects\MavenRightMultiModuleParent\child2webapp\pom.xml
......
[INFO] Cleaning up after release...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] MavenRightMultiModuleParent ....................... SUCCESS [16.766s]
[INFO] child1webapp Maven Webapp ......................... SKIPPED
[INFO] child2webapp ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.911s
[INFO] Finished at: Fri Jan 25 00:38:58 EST 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
Is correct.
If the children have not put the tag "version" does not need to be updated.
The end result is correct.
you can not update the children if you put the tag "version" within the "parent", if you want to update the child, enter the version number of the parent as follows:
<parent>
<groupId>com.xxx</groupId>
<artifactId>xxx</artifactId>
<version>X.X.X</version>
</parent>
thus, incorporating the property "-DautoVersionSubmodules=true", ex: "mvn -B release:clean release:prepare release:perform -DautoVersionSubmodules=true", automatically update all calls of the children to the "parent"
I'm suffering an issue similar to Maven 2 - different dependency versions in test and compile but the specified answer there does not work.
In my project I need to depend on a Cloudera distribution of Hadoop and a 'vanilla' version for JUnit testing, as the former only works on *nix.
When I try and execute my application, I get Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration. When I run JUnit tests from Maven or Eclipse, everything works fine. If I comment out the test dependencies, the application runs successfully.
Why is the compile dependency getting ignored when the test dependency is uncommented?
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2-cdh3u2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-test</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
mvn dependency:list is shown below. The compile scoped version does not show up at all:
[INFO] The following files have been resolved:
[INFO] ant:ant:jar:1.6.5:test
[INFO] aopalliance:aopalliance:jar:1.0:compile
[INFO] asm:asm:jar:3.3.1:compile
[INFO] cglib:cglib:jar:2.2.2:compile
[INFO] ch.qos.logback:logback-classic:jar:1.0.0:compile
[INFO] ch.qos.logback:logback-core:jar:1.0.0:compile
[INFO] com.google.guava:guava:jar:r08:compile
[INFO] com.h2database:h2:jar:1.3.164:test
[INFO] com.jolbox:bonecp:jar:0.7.1.RELEASE:compile
[INFO] com.sun.jersey:jersey-core:jar:1.11:test
[INFO] commons-beanutils:commons-beanutils:jar:1.7.0:test
[INFO] commons-beanutils:commons-beanutils-core:jar:1.8.0:test
[INFO] commons-cli:commons-cli:jar:1.2:test
[INFO] commons-codec:commons-codec:jar:1.4:test
[INFO] commons-collections:commons-collections:jar:3.2.1:test
[INFO] commons-configuration:commons-configuration:jar:1.6:test
[INFO] commons-digester:commons-digester:jar:1.8:test
[INFO] commons-el:commons-el:jar:1.0:test
[INFO] commons-httpclient:commons-httpclient:jar:3.0.1:test
[INFO] commons-lang:commons-lang:jar:2.4:test
[INFO] commons-logging:commons-logging:jar:1.1.1:compile
[INFO] commons-net:commons-net:jar:1.4.1:test
[INFO] hsqldb:hsqldb:jar:1.8.0.10:test
[INFO] junit:junit:jar:4.10:test
[INFO] mysql:mysql-connector-java:jar:5.1.18:compile
[INFO] net.java.dev.jets3t:jets3t:jar:0.7.1:test
[INFO] net.sf.kosmosfs:kfs:jar:0.3:test
[INFO] org.apache.commons:commons-math:jar:2.1:test
[INFO] org.apache.ftpserver:ftplet-api:jar:1.0.0:test
[INFO] org.apache.ftpserver:ftpserver-core:jar:1.0.0:test
[INFO] org.apache.ftpserver:ftpserver-deprecated:jar:1.0.0-M2:test
[INFO] org.apache.hadoop:hadoop-core:jar:1.0.0:test
[INFO] org.apache.hadoop:hadoop-test:jar:1.0.0:test
[INFO] org.apache.mina:mina-core:jar:2.0.0-M5:test
[INFO] org.codehaus.jackson:jackson-core-asl:jar:1.0.1:test
[INFO] org.codehaus.jackson:jackson-mapper-asl:jar:1.0.1:test
[INFO] org.eclipse.jdt:core:jar:3.1.1:test
[INFO] org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] org.liquibase:liquibase-core:jar:2.0.3:test
[INFO] org.liquibase.ext:liquibase-slf4j:jar:0.0.1:test
[INFO] org.mortbay.jetty:jetty:jar:6.1.26:test
[INFO] org.mortbay.jetty:jetty-util:jar:6.1.26:test
[INFO] org.mortbay.jetty:jsp-2.1:jar:6.1.14:test
[INFO] org.mortbay.jetty:jsp-api-2.1:jar:6.1.14:test
[INFO] org.mortbay.jetty:servlet-api:jar:2.5-20081211:test
[INFO] org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:test
[INFO] org.slf4j:jcl-over-slf4j:jar:1.6.4:compile
[INFO] org.slf4j:log4j-over-slf4j:jar:1.6.4:compile
[INFO] org.slf4j:slf4j-api:jar:1.6.4:compile
[INFO] org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
[INFO] org.springframework:spring-test:jar:3.1.1.RELEASE:test
[INFO] org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] org.springframework.data:spring-data-hadoop:jar:1.0.0.BUILD-SNAPSHOT:c
ompile
[INFO] oro:oro:jar:2.0.8:test
[INFO] tomcat:jasper-compiler:jar:5.5.12:test
[INFO] tomcat:jasper-runtime:jar:5.5.12:test
[INFO] xmlenc:xmlenc:jar:0.52:test
What you desire, is no longer valid for Maven 3 (this used to be valid for Maven 2). Maven 3 will attempt to obtain the nearest dependency, effectively ensuring that only one of the compile or test scoped dependency is used for both the compile and test phases.
In your case org.apache.hadoop:hadoop-core:1.0.0:test overrides org.apache.hadoop:hadoop-core:0.20.2-cdh3u2:compile and hence becomes the nearest dependency. You may see the following warning displayed by Maven when running the mvn dependency:list goal, that alludes to this being a problem in your project model:
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be
unique: org.apache.hadoop:hadoop-core:jar -> version 0.20.2-cdh3u2 vs 1.0.0 # line xyz, column xyz
To 'fix' this, it would be better to split your tests into a separate project whose project model can define a separate set of test dependencies.
Looks like a maven bug - or if not, something that is fishy enough I wouldn't trust the documentation if there were any.
In your case, I would probably:
upgrade maven and see if the issue is fixed in the latest m3
try repackaging one of the hadoop versions with another artifact id or group name. maven-shade-plugin, don't bother changing the package name, but just introduce something maven won't know is no different from org.apache.hadoop:hadoop-core
try moving the tests to a separate project downstream
start debugging maven and understand what's going on exactly (and then fall back on 1 or 2...)
i have a multi-module project and am stuck with this strange situation:
command> mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mysoft-service-api 3.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # mysoft-service-api ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\dev\mysoft\service\api\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # mysoft-service-api ---
[INFO] Compiling 150 source files to C:\dev\mysoft\service\api\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # mysoft-service-api ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\dev\mysoft\service\api\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # mysoft-service-api ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.5:test (default-test) # mysoft-service-api ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) # mysoft-service-api ---
[INFO] Building jar: C:\dev\mysoft\service\api\target\mysoft-service-api-3.4-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.524s
[INFO] Finished at: Thu Mar 15 19:54:12 EET 2012
[INFO] Final Memory: 21M/225M
[INFO] ------------------------------------------------------------------------
after this the target/classes folder is empty. how could that be, when the classes were found and it reports build success?
the jar is built also, but obviously without classes in it.
this module's pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mysoft-service</artifactId>
<groupId>mysoft.service</groupId>
<version>3.4-SNAPSHOT</version>
</parent>
<groupId>mysoft.service.api</groupId>
<artifactId>mysoft-service-api</artifactId>
<name>mysoft-service-api</name>
<version>3.4-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
using maven 3.0.4.
any hint would be much appreciated (have been trying various things for days).
the whole software compiles and runs fine in intellij idea.
and yes i did run mvn clean, and did a fresh checkout. in fact i even used a fresh windows install with everything fresh (no local mvn repo leftovers) to be sure, and can reproduce that problem. running mvn from IDE and command line.
Even if this question has got an accepted answer and is very old, I'd like to give the solution that worked for me since I've faced the same problem, for the OP and possibly future readers.
In my case, I was building an annotation processor project and the build wasn't showing any error and yet not producing any class file. In my src/main/resources folder I had a file META-INF/services/javax.annotation.processing.Processor with the definition of the annotation processor classes. I've figured out that's was causing the problem. In order to fix it, I had to add this configuration to my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<compilerArgument>
-proc:none
</compilerArgument>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
The compiler argument -proc:none will be passed directly to javac, disabling the annotation processing for this project build and compiling the classes.
I'm not sure if this was the solution to your specific case but I hope this may help somebody in the future.
Are you looking into the correct folder: C:\dev\mysoft\service\api\target\classes Furhtermore have you tried to do:
mvn clean package
instead.
We've never figured out what exactly the problem was. But after some pom refactorings the problem went away. So I'm "closing" this now.