You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sahoo <Sa...@Sun.COM> on 2008/09/19 17:09:12 UTC

[Need Help] Re: jar artifact contains more classes than desired.

I have got closer to why it is happening. I wrote a small dtrace[1] 
script to monitor open system calls for those additional class files. I 
attached it to a build m/c and after around 150 builds, once it 
occurred. Every time open system call was made with that file handle, I 
print the java stack. The output of dtrace is attached here with. That 
file got opened three times. As the stack suggests, first by 
maven-compiler-plugin, then by maven-bundle-plugin and finally by 
maven-jar-plugin. So, it is the compiler-plugin that is responsible for 
creating that servlet class in jacc target dir. That is very surprising. 
*Why would compiler-plugin compile dependencies? *Any clue?

Thanks,
Sahoo

[1] http://opensolaris.org/os/community/dtrace/

Sahoo wrote:
> We are experiencing an issue in our build system and it is not 
> happening for every one. I used to think it only happens for mvn 
> 2.0.8, but just now a developer told me that they see it mvn 2.0.7 as 
> well. For whatever reason, sometimes, a jar artifact is containing not 
> only the classes compiled from the sources that are part of that 
> artifact, it also contains dependent .class files. It is a very 
> serious problem for us. Given below is the artifact that's causing 
> trouble.
> <project ...>
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>        <groupId>org.glassfish</groupId>
>        <artifactId>api-pom</artifactId>
>        <version>10.0-SNAPSHOT</version>
>    </parent>
>    <artifactId>javax.security.jacc</artifactId>
>    <packaging>jar</packaging>
>    <name>javax.security.jacc API v.1.2</name>
>    <dependencies>
>        <dependency>
>            <groupId>org.glassfish</groupId>
>            <artifactId>javax.servlet</artifactId>
>            <version>${project.version}</version>
>        </dependency>
>   </dependencies>
> </project>
>
> As you can see, it depends on 
> org.glassfish:javax.servlet:10.0-SNAPSHOT, which is a jar type 
> artifact and contains javax.servlet classes. I can assure you that in 
> the source tree of javax.security.jacc module, there is no 
> javax.servlet class. Yet, javax.security.jacc-10.0-SNAPSHOT.jar 
> contains a bunch of javax.servlet classes. I should also state that it 
> only happens when both javax.servlet module and javax.security.jacc 
> module are part of same maven reactor. The build log produced with -X 
> option is quite large, so I am supplying log for jacc module portion 
> only. Pl. see the attachment called build.all.jacc.log. I will be 
> happy to supply more of it if need be. I should say, I don't 
> understand something from the log file. I am highlighting it here with 
> bold letters:
>
> [INFO] Reactor build order:
> ...
> [INFO]   javax.servlet API v.3.0
> [INFO]   javax.security.jacc API v.1.2
> ...
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building javax.servlet API v.3.0
> [INFO]    task-segment: [clean, install]
> [INFO] 
> ------------------------------------------------------------------------
> ...
> [INFO] Installing 
> /export/v3/v3/web/javax.servlet/target/javax.servlet-10.0-SNAPSHOT-sources.jar 
> to 
> /home/mvatkina/.m2/repository/org/glassfish/javax.servlet/10.0-SNAPSHOT/javax.servlet-10.0-SNAPSHOT-sources.jar 
>
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building javax.security.jacc API v.1.2
> [INFO]    task-segment: [clean, install]
> [INFO] 
> ------------------------------------------------------------------------
> ...
> [INFO] [clean:clean]
> [INFO] Deleting directory 
> /export/v3/v3/security/javax.security.jacc/target
> [DEBUG] org.glassfish:javax.security.jacc:jar:10.0-SNAPSHOT (selected 
> for null)
> [DEBUG]   junit:junit:jar:4.3.1:test (selected for test)
> [DEBUG]   active project artifact:
> *        artifact = 
> org.glassfish:javax.servlet:jar:10.0-SNAPSHOT:compile;
>        project: MavenProject: 
> org.glassfish:javax.servlet:10.0-SNAPSHOT @ 
> /export/v3/v3/web/javax.servlet/pom.xml (selected for compile)
> *
> What does this active project artifact mean? By looking at the 
> attached log file, do you have any suggestion for me?
>
> Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>