Transitive dependency question
(I've been working with Maven since at least 2004 and I think I *still* don't get transitive dependencies.) I have a pom.xml file of type pom that has some compile-scoped dependencies in it. (P1 -> A(compile), B(compile)) I have another project that depends on this pom in provided scope (I'm just playing around for now). The intention is that I will "get" all the transitive compile-scoped dependencies of the pom artifact I'm depending on, but in provided scope. (P2 -> P1(provided); result is effectively: P2 -> P1(provided) -> A(provided), B(provided)) If that's all I have, then indeed, that's the result I observe: when I run the maven-dependency-plugin's dependency-tree goal, I see these transitive dependencies and they are all marked as being in provided scope, not compile. I see, in other words, the tree representation of P2 -> P1(provided) -> A(provided), B(provided). So far so good. Now I pull in another (jar) dependency in runtime scope. It has some transitive dependencies in compile scope. Fine. They don't include any of the dependencies mentioned in my second paragraph. (P2 -> (P1(provided) -> A(provided),B(provided)), (P3(runtime) -> C(compile),D(compile))) Note that this pseudo-language is what I *expect* to see. When I run dependency:tree on this hairy mess, it does *not* show the representation of my pseudo-language above. Instead, it shows the transitive dependencies from my third paragraph as direct "children" of the pom-type artifact I'm pulling in in provided scope (P1), but they all have a scope of runtime. So, for just this part of the tree: P2 -> P1(provided) -> A(runtime(!)), B(runtime(!)) What the…? In other words, somebody in the tree is "promoting" my A and B dependencies to runtime scope. But I can't tell from the tree output who it is, because A and B (that are now apparently runtime-scoped dependencies) are still showing as children of my pom artifact (P1, mentioned in my second paragraph). Is this all according to plan? I'm using version 3.0.0 of the maven-dependency-plugin and version 3.5.0 of Maven itself. Best, Laird
Re: Work-around for antrun AttachArtifact not working in external Ant build file
Hi, I looked into this issue and committed a fix for it. The core problem was that the 'attachartifact' task launched from the external Ant build was working from a clone of the Maven project, instead of the project itself. Can you try the latest 3.0.0-SNAPSHOT and report back? Le 31/05/2017 à 19:14, Jürgen Weber a écrit : Hi, I found a solution, not pretty, but it actually works: in an pom-inline antrun task call a Javascript function with the project as parameter, in Javascript one can do all interesting things (loop over properties from an ant property file) and call the attachartifact task. Cheers, Juergen script.js: var runtaskf = function(project) { aa = project.createTask("attachartifact"); f = new java.io.File("my.jar"); aa.setFile(f); aa.setType("jar"); aa.setClassifier("test"); aa.perform(); } 2017-05-31 18:32 GMT+02:00 Karl Heinz Marbaise : Hi, if i correctly understand you have a property file for each environment and maybe some other files and a base artifact (jar/war?) now it sounds you have to build for each environment a different jar/war ? Maybe something like this could help here: https://github.com/khmarbaise/multienv-maven-plugin/ or: https://github.com/khmarbaise/iterator-maven-plugin/ Kind regards Karl Heinz Marbaise On 31/05/17 11:42, Jürgen Weber wrote: Hi Jörg, problem is, I have to build message driven beans, some 20, only difference is the queue name in the deployment descriptor. Queue names are listed in a property file. I know that Maven wants no environment specific properties in artifacts, but Sun defined the activation spec for MDBs. And the activation spec is in code or in ejb-jar.xml, both in the mdb jar. So I have to build a different MDB for each queue. And I have to iterate over the queues (which is possible in ant + JavaScript. Yuck). So I'd need to attach n artefacts, wherea in a Maven pom I have to list each artefact individually. Greetings, Jürgen Am 30.05.2017 08:45 schrieb "Jörg Schaible" : Hi Jürgen, Jürgen Weber wrote: What is the recommended work-around for attaching artifacts created by antrun? * forward target directory as variable to ant ? That helps if the created files should be removed in a normal "clean" phase. * build-helper-maven-plugin attach-artifact ? Definitely the proper action. http://technotes.khitrenovich.com/attach-maven-artifact- external-build-xml-file/ https://issues.apache.org/jira/browse/MANTRUN-181 Thx, Juergen Cheers, Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Work-around for antrun AttachArtifact not working in external Ant build file
Hi, I found a solution, not pretty, but it actually works: in an pom-inline antrun task call a Javascript function with the project as parameter, in Javascript one can do all interesting things (loop over properties from an ant property file) and call the attachartifact task. Cheers, Juergen script.js: var runtaskf = function(project) { aa = project.createTask("attachartifact"); f = new java.io.File("my.jar"); aa.setFile(f); aa.setType("jar"); aa.setClassifier("test"); aa.perform(); } 2017-05-31 18:32 GMT+02:00 Karl Heinz Marbaise : > Hi, > > if i correctly understand you have a property file for each environment and > maybe some other files and a base artifact (jar/war?) now it sounds you have > to build for each environment a different jar/war ? > > Maybe something like this could help here: > > https://github.com/khmarbaise/multienv-maven-plugin/ > > or: > > https://github.com/khmarbaise/iterator-maven-plugin/ > > > Kind regards > Karl Heinz Marbaise > > > On 31/05/17 11:42, Jürgen Weber wrote: >> >> Hi Jörg, >> problem is, I have to build message driven beans, some 20, only difference >> is the queue name in the deployment descriptor. Queue names are listed in >> a >> property file. >> I know that Maven wants no environment specific properties in artifacts, >> but Sun defined the activation spec for MDBs. And the activation spec is >> in >> code or in ejb-jar.xml, both in the mdb jar. So I have to build a >> different >> MDB for each queue. And I have to iterate over the queues (which is >> possible in ant + JavaScript. Yuck). >> So I'd need to attach n artefacts, wherea in a Maven pom I have to list >> each artefact individually. >> Greetings, Jürgen >> >> Am 30.05.2017 08:45 schrieb "Jörg Schaible" >> >> >>> : >> >> >> Hi Jürgen, >> >> Jürgen Weber wrote: >> >>> What is the recommended work-around for attaching artifacts created by >>> antrun? >>> >>> * forward target directory as variable to ant ? >> >> >> That helps if the created files should be removed in a normal "clean" >> phase. >> >>> * build-helper-maven-plugin attach-artifact ? >> >> >> Definitely the proper action. >> >>> http://technotes.khitrenovich.com/attach-maven-artifact- >> >> external-build-xml-file/ >>> >>> https://issues.apache.org/jira/browse/MANTRUN-181 >>> >>> Thx, >>> Juergen >> >> >> Cheers, >> Jörg >> > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Work-around for antrun AttachArtifact not working in external Ant build file
Hi, if i correctly understand you have a property file for each environment and maybe some other files and a base artifact (jar/war?) now it sounds you have to build for each environment a different jar/war ? Maybe something like this could help here: https://github.com/khmarbaise/multienv-maven-plugin/ or: https://github.com/khmarbaise/iterator-maven-plugin/ Kind regards Karl Heinz Marbaise On 31/05/17 11:42, Jürgen Weber wrote: Hi Jörg, problem is, I have to build message driven beans, some 20, only difference is the queue name in the deployment descriptor. Queue names are listed in a property file. I know that Maven wants no environment specific properties in artifacts, but Sun defined the activation spec for MDBs. And the activation spec is in code or in ejb-jar.xml, both in the mdb jar. So I have to build a different MDB for each queue. And I have to iterate over the queues (which is possible in ant + JavaScript. Yuck). So I'd need to attach n artefacts, wherea in a Maven pom I have to list each artefact individually. Greetings, Jürgen Am 30.05.2017 08:45 schrieb "Jörg Schaible" : Hi Jürgen, Jürgen Weber wrote: What is the recommended work-around for attaching artifacts created by antrun? * forward target directory as variable to ant ? That helps if the created files should be removed in a normal "clean" phase. * build-helper-maven-plugin attach-artifact ? Definitely the proper action. http://technotes.khitrenovich.com/attach-maven-artifact- external-build-xml-file/ https://issues.apache.org/jira/browse/MANTRUN-181 Thx, Juergen Cheers, Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Work-around for antrun AttachArtifact not working in external Ant build file
Hi Jörg, problem is, I have to build message driven beans, some 20, only difference is the queue name in the deployment descriptor. Queue names are listed in a property file. I know that Maven wants no environment specific properties in artifacts, but Sun defined the activation spec for MDBs. And the activation spec is in code or in ejb-jar.xml, both in the mdb jar. So I have to build a different MDB for each queue. And I have to iterate over the queues (which is possible in ant + JavaScript. Yuck). So I'd need to attach n artefacts, wherea in a Maven pom I have to list each artefact individually. Greetings, Jürgen Am 30.05.2017 08:45 schrieb "Jörg Schaible" : Hi Jürgen, Jürgen Weber wrote: > What is the recommended work-around for attaching artifacts created by > antrun? > > * forward target directory as variable to ant ? That helps if the created files should be removed in a normal "clean" phase. > * build-helper-maven-plugin attach-artifact ? Definitely the proper action. > http://technotes.khitrenovich.com/attach-maven-artifact- external-build-xml-file/ > https://issues.apache.org/jira/browse/MANTRUN-181 > > Thx, > Juergen Cheers, Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org