Ok ... so I did some more debugging ...

I output the classpath and it seemed to contain the jar containing the class I 
tried to load. So I took the urls of the existing Classloader and created a new 
Instance with exactly this set of URLs and I was able to load the class. Is is 
possible that Maven can have problems with classloaders if the JARs it contains 
are replaced during the build?

I did encounter similar problems with other builds and they always occur if I 
load classes in plugins that have been built as part of the build. 

Is there a way to avoid this type of problem?

Chris

________________________________________
Von: Christofer Dutz <[email protected]>
Gesendet: Dienstag, 29. März 2016 19:14
An: [email protected]
Betreff: AW: Plugin dependencies to artifacts of the same build?

Sorry ... that email went off unintentionally ... well to continue ... if the 
plugin is part of the reactor:

---------------------------------------------------
constituent[0]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-api-1.0.2.v20150114.jar
constituent[1]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-connector-basic-1.0.2.v20150114.jar
constituent[2]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-impl-1.0.2.v20150114.jar
constituent[3]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-spi-1.0.2.v20150114.jar
constituent[4]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-transport-wagon-1.0.2.v20150114.jar
constituent[5]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aether-util-1.0.2.v20150114.jar
constituent[6]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/aopalliance-1.0.jar
constituent[7]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/cdi-api-1.0.jar
constituent[8]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/commons-cli-1.2.jar
constituent[9]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/commons-io-2.2.jar
constituent[10]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/commons-lang-2.6.jar
constituent[11]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/guava-18.0.jar
constituent[12]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/javax.inject-1.jar
constituent[13]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/jsoup-1.7.2.jar
constituent[14]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/jsr250-api-1.0.jar
constituent[15]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-aether-provider-3.3.3.jar
constituent[16]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-artifact-3.3.3.jar
constituent[17]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-builder-support-3.3.3.jar
constituent[18]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-compat-3.3.3.jar
constituent[19]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-core-3.3.3.jar
constituent[20]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-embedder-3.3.3.jar
constituent[21]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-model-3.3.3.jar
constituent[22]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-model-builder-3.3.3.jar
constituent[23]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-plugin-api-3.3.3.jar
constituent[24]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-repository-metadata-3.3.3.jar
constituent[25]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-settings-3.3.3.jar
constituent[26]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/maven-settings-builder-3.3.3.jar
constituent[27]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/org.eclipse.sisu.inject-0.3.0.jar
constituent[28]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/org.eclipse.sisu.plexus-0.3.0.jar
constituent[29]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/plexus-cipher-1.7.jar
constituent[30]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/plexus-component-annotations-1.5.5.jar
constituent[31]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/plexus-interpolation-1.21.jar
constituent[32]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/plexus-sec-dispatcher-1.3.jar
constituent[33]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/plexus-utils-3.0.20.jar
constituent[34]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/sisu-guice-3.2.5-no_aop.jar
constituent[35]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/slf4j-api-1.7.5.jar
constituent[36]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/slf4j-simple-1.7.5.jar
constituent[37]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/wagon-file-2.9.jar
constituent[38]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/wagon-http-2.9-shaded.jar
constituent[39]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/wagon-http-shared-2.9.jar
constituent[40]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/lib/wagon-provider-api-2.9.jar
constituent[41]: 
file:/Users/christoferdutz/Devtools/Apache/apache-maven-3.3.3/conf/logging/
---------------------------------------------------

So it's missing all of these:

/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/flexjs-maven-plugin/0.6.0-SNAPSHOT/flexjs-maven-plugin-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler-jx/0.6.0-SNAPSHOT/compiler-jx-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler/0.6.0-SNAPSHOT/compiler-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler-jburg-types/0.6.0-SNAPSHOT/compiler-jburg-types-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
/Users/christoferdutz/Maven-Repository/org/antlr/antlr/3.3/antlr-3.3.jar
/Users/christoferdutz/Maven-Repository/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar
/Users/christoferdutz/Maven-Repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar
/Users/christoferdutz/Maven-Repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
/Users/christoferdutz/Maven-Repository/com/google/guava/guava/18.0/guava-18.0.jar
/Users/christoferdutz/Maven-Repository/net/sourceforge/jburg/jburg/1.10.3/jburg-1.10.3.jar
/Users/christoferdutz/Maven-Repository/de/jflex/jflex/1.6.0/jflex-1.6.0.jar
/Users/christoferdutz/Maven-Repository/org/apache/ant/ant/1.7.0/ant-1.7.0.jar
/Users/christoferdutz/Maven-Repository/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar
/Users/christoferdutz/Maven-Repository/org/b1/pack/lzma-sdk-4j/9.22.0/lzma-sdk-4j-9.22.0.jar
/Users/christoferdutz/Maven-Repository/args4j/args4j/2.0.28/args4j-2.0.28.jar
/Users/christoferdutz/Maven-Repository/org/codeartisans/org.json/20131017/org.json-20131017.jar
/Users/christoferdutz/Maven-Repository/com/google/javascript/closure-compiler/v20151015/closure-compiler-v20151015.jar
/Users/christoferdutz/Maven-Repository/org/clojure/google-closure-library/0.0-20150902-b129bb9e/google-closure-library-0.0-20150902-b129bb9e.jar
/Users/christoferdutz/Maven-Repository/org/clojure/google-closure-library-third-party/0.0-20150902-b129bb9e/google-closure-library-third-party-0.0-20150902-b129bb9e.jar

Can anyone here explain why?

Chris

________________________________________
Von: Christofer Dutz
Gesendet: Dienstag, 29. März 2016 19:13
An: [email protected]
Betreff: AW: Plugin dependencies to artifacts of the same build?

So I added some code to dump the threads context classpath during the execution 
of the plugin:

If I execute everything without the plugin being part of the reactor, I get 
this:

[INFO] --- flexjs-maven-plugin:0.6.0-SNAPSHOT:generate (default-generate) @ 
flexjs-externs-js ---
Classpath
-----------------------------------------------------
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/flexjs-maven-plugin/0.6.0-SNAPSHOT/flexjs-maven-plugin-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler-jx/0.6.0-SNAPSHOT/compiler-jx-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler/0.6.0-SNAPSHOT/compiler-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flexjs/compiler/compiler-jburg-types/0.6.0-SNAPSHOT/compiler-jburg-types-0.6.0-SNAPSHOT.jar
/Users/christoferdutz/Maven-Repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
/Users/christoferdutz/Maven-Repository/org/antlr/antlr/3.3/antlr-3.3.jar
/Users/christoferdutz/Maven-Repository/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar
/Users/christoferdutz/Maven-Repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar
/Users/christoferdutz/Maven-Repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
/Users/christoferdutz/Maven-Repository/com/google/guava/guava/18.0/guava-18.0.jar
/Users/christoferdutz/Maven-Repository/net/sourceforge/jburg/jburg/1.10.3/jburg-1.10.3.jar
/Users/christoferdutz/Maven-Repository/de/jflex/jflex/1.6.0/jflex-1.6.0.jar
/Users/christoferdutz/Maven-Repository/org/apache/ant/ant/1.7.0/ant-1.7.0.jar
/Users/christoferdutz/Maven-Repository/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar
/Users/christoferdutz/Maven-Repository/org/b1/pack/lzma-sdk-4j/9.22.0/lzma-sdk-4j-9.22.0.jar
/Users/christoferdutz/Maven-Repository/args4j/args4j/2.0.28/args4j-2.0.28.jar
/Users/christoferdutz/Maven-Repository/org/codeartisans/org.json/20131017/org.json-20131017.jar
/Users/christoferdutz/Maven-Repository/com/google/javascript/closure-compiler/v20151015/closure-compiler-v20151015.jar
/Users/christoferdutz/Maven-Repository/org/clojure/google-closure-library/0.0-20150902-b129bb9e/google-closure-library-0.0-20150902-b129bb9e.jar
/Users/christoferdutz/Maven-Repository/org/clojure/google-closure-library-third-party/0.0-20150902-b129bb9e/google-closure-library-third-party-0.0-20150902-b129bb9e.jar
/Users/christoferdutz/Maven-Repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
/Users/christoferdutz/Maven-Repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
/Users/christoferdutz/Maven-Repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
/Users/christoferdutz/Maven-Repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
/Users/christoferdutz/Maven-Repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
/Users/christoferdutz/Maven-Repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
/Users/christoferdutz/Maven-Repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
/Users/christoferdutz/Maven-Repository/org/codehaus/plexus/plexus-compiler-api/2.2/plexus-compiler-api-2.2.jar
/Users/christoferdutz/Maven-Repository/commons-io/commons-io/2.4/commons-io-2.4.jar
/Users/christoferdutz/Maven-Repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.jar
/Users/christoferdutz/Maven-Repository/org/codehaus/plexus/plexus-utils/3.0.3/plexus-utils-3.0.3.jar
/Users/christoferdutz/Maven-Repository/org/apache/flex/flex-tool-api/1.0.0/flex-tool-api-1.0.0.jar
-----------------------------------------------------

In case the plugin is part of the reactor, the list looks like this:


________________________________________
Von: Christofer Dutz <[email protected]>
Gesendet: Dienstag, 29. März 2016 16:14
An: [email protected]
Betreff: Plugin dependencies to artifacts of the same build?

Hi,


I am currently trying to sort out some glitches in my Maven build.

I am working on a new flexjs-maven-plugin as part of my efforts to migrate more 
and more of the Apache Flex project to Maven.


In the reactor I have a a compiler, a maven-plugin providing a custom lifecycle 
mapping for FlexJS projects, and a set of libraries that are built using the 
maven-plugin and the compiler (Let's call them "framework"). The maven plugin 
uses an externally released API to decouple the plugin from the compiler.


I know that if you start from scratch, Maven will abort with an error message 
as the maven plugin does not exist and it needs that for the framework. For 
this reason I have a "minimal" profile that simply builds the maven plugin. So 
ideally you only have to build once with the "minimal" profile and then you can 
go back to the "default" profile, which builds everything (I know this is not 
ideal, but I haven't come across a solution that would not have me split up 
everything into completely separate Projects ... anyway ... my problem is not 
directly related to this problem)


If building everything in one big build I get ClassNotFound exceptions from the 
Maven-Plugin complaining the compiler classes not being available, if however I 
build only the framework all is good. So I am guessing that if Maven starts 
building and a plugin references a library that is re-built prior to it's usage 
inside the same build, the jar is no longer available. Why is that the case? 
... Flexmojos (another plugin I have been maintaining for years now) relies 
heavily on this and It must have been working prior to my new plugin.


I am using Maven 3.3.3 and Oracle Java 1.7


Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to