Brian,
Maybe a dumb question, but is there a way I can just use the
maven-dependency-plugin programatically to accomplish what I'm trying
to do?
Can I just pull the plugin jar in so it is on the classpath like any
other dependency and use its API to get project.getArtifacts() ?
On Wed, Mar 19, 2008 at 6:02 PM, Brian E. Fox <[EMAIL PROTECTED]> wrote:
> Actually getting the list via a plugin is trivial. Just set a parameter
> like this:
>
> /**
> * POM
> *
> * @parameter expression="${project}"
> * @readonly
> * @required
> */
> protected MavenProject project;
>
> And then project.getArtifacts() will be all (including transitive)
> dependencies. You'll also need to specify @requiresDependencyResolution
> [scope] in the mojo annotations.
>
> There is also a tree component that you could use to get the output used
> to generate dependency:tree
>
>
> -----Original Message-----
> From: Davis Ford [mailto:[EMAIL PROTECTED]
>
> Sent: Wednesday, March 19, 2008 5:57 PM
> To: Maven Users List
>
>
> Subject: Re: maven-dependency-plugin
>
> Hi Brian,
>
> Indeed -- total goof-up on my part. I had multiple project pom.xml
> files and was editing the wrong one. It works like a charm.
>
> Quick related question...the whole purpose of me dumping this to a
> text file was because I could not see an easy way to programmatically
> get a list of all project dependencies....so I figured I'd create the
> .txt file and parse it myself.
>
> The reason I want this list is as part of reporting framework we have.
> We run a long-running set of quality checks on some data, and I need
> to be able to store with the final report the list of all things like
> .jar versions, database versions, etc., etc.
>
> Is there somewhere an API that would let me retrieve this same
> information in the code?
>
> Regards,
> Davis
>
> On Wed, Mar 19, 2008 at 4:50 PM, Brian E. Fox <[EMAIL PROTECTED]>
> wrote:
> > I just double checked the code and this should work. Is it displaying
> > the list to the output? If not, then it's going to a file somewhere.
> It
> > would be better to use ${project.build.directory}/output.txt instead
> so
> > it goes to /target/output.txt
> >
> >
> >
> > -----Original Message-----
> > From: Davis Ford [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 19, 2008 4:46 PM
> > To: Maven Users List
> > Subject: maven-dependency-plugin
> >
> > Hi, I'm trying to use the maven-dependency-plugin to dump a list of
> > the project's dependencies out to a text file, but I can not seem to
> > get it to do anything.
> >
> > relevant configuration:
> >
> > <plugin>
> >
> > <groupId>org.apache.maven.plugins</groupId>
> >
> > <artifactId>maven-dependency-plugin</artifactId>
> > <version>2.0</version>
> > <executions>
> > <execution>
> >
> > <id>write-dependencies</id>
> > <phase>compile</phase>
> > <goals>
> >
> > <goal>list</goal>
> > </goals>
> > <configuration>
> >
> > <outputFile>dependencies.txt</outputFile>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> > </plugins>
> > </build>
> >
> > I would expect that if I do "mvn compile" it would create
> > dependencies.txt but it does not. Anyone have an idea what I'm doing
> > wrong here?
> >
> > Thanks in advance,
> > Davis
> >
> > ---------------------------------------------------------------------
> > 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]
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]