You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by sirji <sr...@gmail.com> on 2007/03/12 13:58:47 UTC

Re: [m2] use mvn install inside POM.xml

Thanks alot Neeraj for your response.. :) I believe you understood my issue.

Our requirement doesn't allow us to use manual procedure. :(

Now, regarding the ant task for Maven, I have been trying "Antlib for Maven
2.0" [http://maven.apache.org/ant-tasks.html].. Unfortunately, this isn't
working for me.  I am facing two issues with it.

First, "maven-artifact-ant-2.0.4-dep.jar" required for this task is
available for Maven 2.0.4 not for Maven 2.0.5. Even with Maven 2.0.4, I am
getting following error:-

C:\>mvn install

[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO]
org.apache.maven.profiles.ProfileManager.loadSettingsProfiles(Lorg/apache/maven/settings/Settings;)V
[INFO]
------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError:
org.apache.maven.profiles.ProfileManager.loadSettingsProfiles(Lorg/apache/maven/settings/Se
ttings;)V
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO]
------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Mon Mar 12 18:11:25 IST 2007
[INFO] Final Memory: 1M/3M
[INFO]
------------------------------------------------------------------------

This happens after I place "maven-artifact-ant-2.0.4-dep.jar" into the
Maven's lib directory. And if I remove this jar file, I get following
error:-


[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: Could not create task or type of type: artifact:install.

Ant could not find the task or a class this task relies upon.

Kindly let me where I am going wrong?

Thanks & regards,
SR



Neeraj Bisht wrote:
> 
> There are two solution
> 
> 1)put that jar manually in the Repository
> 
> 2) or use ANT task inside the Pom.xml (use copy task of ant)
> 
> On 3/12/07, Gregory Kick <gk...@gmail.com> wrote:
>>
>> It doesn't look like it because you can't override artifactId,
>> groupId, file, etc.
>>
>> On 3/12/07, sirji <sr...@gmail.com> wrote:
>> >
>> > Hi all,
>> >
>> > I have project requirement where we need to install custom jar file
>> > (generated using another project) into the maven local repository using
>> mvn
>> > install command.
>> >
>> > My question is: How can we run mvn install command from POM.xml? Kindly
>> let
>> > me know if this is not possible.
>> >
>> > Thanks & regards,
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/use-mvn-install-inside-POM.xml-tf3388796s177.html#a9432558
>> > Sent from the Maven - Users mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>>
>>
>> --
>> Gregory Kick
>> gk5885@gmail.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/use-mvn-install-inside-POM.xml-tf3388796s177.html#a9434064
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] use mvn install inside POM.xml

Posted by Thorsten Heit <th...@gmx.de>.
Hi,

> Now, regarding the ant task for Maven, I have been trying "Antlib for
> Maven
> 2.0" [http://maven.apache.org/ant-tasks.html].. Unfortunately, this isn't
> working for me.  I am facing two issues with it.

The following is a short snippet taken from one of my pom.xml's that works quite well for me (I need to execute some special Ant tasks from within my POM):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <id>compile</id>
      <phase>compile</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <tasks>
          <property name="srcdir" value="${basedir}/../.." />
          <property name="websrcdir" value="${srcdir}/WEB-INF/src/META-INF/properties" />
          <property name="destdir" value="${project.build.directory}/${project.artifactId}-${project.version}" />
          <property name="webdestdir" value="${destdir}/WEB-INF/classes/META-INF" />
          <copy file="${srcdir}/form/file.xml" tofile="${destdir}/form/copied-file.xml" overwrite="true" />
          ...
          <delete dir="${destdir}/tmp" failonerror="false" />
        </tasks>
      </configuration>
    </execution>
  </executions>
</plugin>

Place your Maven commands inside the <tasks>...</tasks> section (should be <install:install-file...> or something similar; see the above URL), and it should work. You only should ensure that you bind the plugin to the correct phase.


> This happens after I place "maven-artifact-ant-2.0.4-dep.jar" into the
> Maven's lib directory.

This file is for _Ant_, not for Maven (see the topic "Installing the Ant Tasks" in the URL you mentioned above)....


HTH

Thorsten

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org