maven package doesn't compile
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:devmysoftserviceapisrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ mysoft-service-api ---
[INFO] Compiling 150 source files to C:devmysoftserviceapitargetclasses
[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:devmysoftserviceapisrctestresources
[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:devmysoftserviceapitargetmysoft-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:
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"> 4.0.0
<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>
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 idea and command line.
Are you looking into the correct folder: C:devmysoftserviceapitargetclasses 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.
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.
链接地址: http://www.djcxy.com/p/37576.html下一篇: maven包不编译