You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Petr V." <gr...@yahoo.com> on 2008/10/29 02:46:09 UTC

How to convert Eclipse project to maven project

I have simple web services demo which I created in Eclipse and added external jar files to project. I am able to run it successfully unit tests in eclipse IDE.

Now I have moved the code to maven project and added dependencies tho those jar files in my pom file. And now the maven project fails complaining "java.lang.NoClassDefFoundError: com/sun/xml/fastinfoset/stax/StAXDocumentParser". 

I installed all jars files manually in my totally new maven repo but maven first downloads pom files for those manually installed jars and then download other jar files which are defined as dependencies in those new downloaded pom files. I do not want any of those newly downloaded jar files. I know my manually installed jar files are good enough to run the project (as shown in eclipse) but maven is doing some thing stupid amd making my project fail at run time complaining of missing class files.

How could I resolve this issue in most cleanest way.I hope that I am able to explain problem clearly.

Any help would be really appreciated.

Thanks,

Petr

 




      

Re: How to convert Eclipse project to maven project

Posted by Stephen Connolly <st...@gmail.com>.
You can use any groupId that you control, and any artifactId within that
groupId.

If you want to force your project to use exactly the jars you specify I
would set the groupId to your company's domain name in reverse order, and
then pick whatever artifactIds you like.

For example on hudson (hudson.dev.java.net) uses some custom builds of
specific artifacts (because it needs patches applied, etc)

There are two options in these cases:
1. use a groupId of net.java.dev.hudson and artifactId of whatever we care
2. use a custom version string, e.g. 1.2-hudson-1

if you use a (groupId,artifactId,version) tripple that is the the public
repos you will run into problems...

since you don't know what versions will be released in somebody else's
(groupId,artifactId)... if you want to keep theirs, you need to make the
version unique (by adding -mycompanyname-1) to the version... and if you
need to update it, you go with -mycompanyname-2, etc

Otherwise use your own groupId and nobdoy else will care what you do in
there (provided you have ownership... e.g. you own the domain name reversed)

-Stephen

2008/10/29 Petr V. <gr...@yahoo.com>

> Once agian thanks Dave for qyuick response.
>
> That's what I did to install manually the jar files in repo.
>
> Are you saying that I could use any random group ids and artifacts ids to
> install my jar files in local repo as long as it those match with my pom
> file ?
>
> So I had lets suppose common-logging-1.2 jar file but I did not know the
> group id and artifact id for this jar file so I search for this jar file on
> maven web site and found group id(gid) and artifact id(aid)[some times there
> are more group ids for same artifact id, how do you decide in that case ??)
> and use those gid/aid to install jar file manually. I never created pom file
> manually but when I issued mvn install then maven downloaded the pom files
> for jar files itself and then some of those pom files have dependencies on
> other jar files and at end I ended up with many un needed jar files..
>
> Am I making any sense ?
>
> Once again big thanks for all help. You people are awesome.
>
> Thanks,
>
> Petr
>
>
>
> --- On Wed, 10/29/08, David C. Hicks <dh...@i-hicks.org> wrote:
>
> > From: David C. Hicks <dh...@i-hicks.org>
> > Subject: Re: How to convert Eclipse project to maven project
> > To: "Maven Users List" <us...@maven.apache.org>
> > Date: Wednesday, October 29, 2008, 8:50 AM
> > Ah.  I see where you went wrong.  It's not even that
> > complicated.  Use
> > the following command to add your jar files to your local
> > repository:
> >
> > mvn install:install-file -Dfile=<path-to-file>
> > -DgroupId=<group-id>
> > -DartifactId=<artifact-id> -Dversion=<version>
> > -Dpackaging=<packaging>
> >
> > Example:  mvn install:install-file -Dfile=myjar.jar
> > -DgroupId=myjar
> > -DartifactId=myjar -Dversion=1.0 -Dpackaging=jar
> >
> > Then, in your pom.xml you would refer to this new
> > artifact/dependency
> > like this:  (using the same example)
> >
> > <dependency>
> >     <groupId>myjar</groupId>
> >     <artifactId>myjar</artifactId>
> >     <version>1.0</version>
> > </dependency>
> >
> > Then, your build will pick up the jar you want it to use.
> > Good luck!
> > Dave
> >
> >
> >
> > Petr V. wrote:
> > > Thanks Dave for such a quick response.
> > >
> > > I started from jar files w/o pom files. So I went to
> > maven repository web site http://www.mvnrepository.com/ and
> > search for those jars. Some of those jars were available
> > under different groups ids but same artifact id like
> > saax-api-1.3.jar is found under javax.xml as javax.xml.soap
> > as well. I picked the most appropriate one using educated
> > guesses. May be that is causing some trouble. How can I find
> > out the correct version of group ids and artifacts ids :-(
> > >
> > > Thanks,
> > >
> > > Petr
> > >
> > >
> > > --- On Wed, 10/29/08, David C. Hicks
> > <dh...@i-hicks.org> wrote:
> > >
> > >
> > >> From: David C. Hicks <dh...@i-hicks.org>
> > >> Subject: Re: How to convert Eclipse project to
> > maven project
> > >> To: "Maven Users List"
> > <us...@maven.apache.org>
> > >> Date: Wednesday, October 29, 2008, 7:01 AM
> > >> Unless you specified the proper versions and
> > classifiers for
> > >> your
> > >> dependencies, then Maven is likely to find the
> > ones that
> > >> are available
> > >> in the primary repository.  Assuming that you used
> > Maven to
> > >> install your
> > >> jar files into your local repository, make sure
> > that your
> > >> pom.xml
> > >> specifies the same groupId, artifactId, and
> > version that
> > >> you used when
> > >> you did that installation.  Otherwise, Maven
> > won't find
> > >> them and will go
> > >> looking for anything else that matches your
> > pom.xml.
> > >>
> > >> I hope that's helpful.
> > >> Dave
> > >>
> > >>
> > >> Petr V. wrote:
> > >>
> > >>> I have simple web services demo which I
> > created in
> > >>>
> > >> Eclipse and added external jar files to project. I
> > am able
> > >> to run it successfully unit tests in eclipse IDE.
> > >>
> > >>> Now I have moved the code to maven project and
> > added
> > >>>
> > >> dependencies tho those jar files in my pom file.
> > And now the
> > >> maven project fails complaining
> > >> "java.lang.NoClassDefFoundError:
> > >>
> > com/sun/xml/fastinfoset/stax/StAXDocumentParser".
> > >>
> > >>> I installed all jars files manually in my
> > totally new
> > >>>
> > >> maven repo but maven first downloads pom files for
> > those
> > >> manually installed jars and then download other
> > jar files
> > >> which are defined as dependencies in those new
> > downloaded
> > >> pom files. I do not want any of those newly
> > downloaded jar
> > >> files. I know my manually installed jar files are
> > good
> > >> enough to run the project (as shown in eclipse)
> > but maven is
> > >> doing some thing stupid amd making my project fail
> > at run
> > >> time complaining of missing class files.
> > >>
> > >>> How could I resolve this issue in most
> > cleanest way.I
> > >>>
> > >> hope that I am able to explain problem clearly.
> > >>
> > >>> Any help would be really appreciated.
> > >>>
> > >>> Thanks,
> > >>>
> > >>> Petr
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail:
> > users-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail:
> > >> users-help@maven.apache.org
> > >>
> > >
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail:
> > users-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail:
> > users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to convert Eclipse project to maven project

Posted by "Petr V." <gr...@yahoo.com>.
Once agian thanks Dave for qyuick response.

That's what I did to install manually the jar files in repo.

Are you saying that I could use any random group ids and artifacts ids to install my jar files in local repo as long as it those match with my pom file ?

So I had lets suppose common-logging-1.2 jar file but I did not know the group id and artifact id for this jar file so I search for this jar file on maven web site and found group id(gid) and artifact id(aid)[some times there are more group ids for same artifact id, how do you decide in that case ??) and use those gid/aid to install jar file manually. I never created pom file manually but when I issued mvn install then maven downloaded the pom files for jar files itself and then some of those pom files have dependencies on other jar files and at end I ended up with many un needed jar files..

Am I making any sense ?

Once again big thanks for all help. You people are awesome.

Thanks,

Petr



--- On Wed, 10/29/08, David C. Hicks <dh...@i-hicks.org> wrote:

> From: David C. Hicks <dh...@i-hicks.org>
> Subject: Re: How to convert Eclipse project to maven project
> To: "Maven Users List" <us...@maven.apache.org>
> Date: Wednesday, October 29, 2008, 8:50 AM
> Ah.  I see where you went wrong.  It's not even that
> complicated.  Use 
> the following command to add your jar files to your local
> repository:
> 
> mvn install:install-file -Dfile=<path-to-file>
> -DgroupId=<group-id> 
> -DartifactId=<artifact-id> -Dversion=<version>
> -Dpackaging=<packaging>
> 
> Example:  mvn install:install-file -Dfile=myjar.jar
> -DgroupId=myjar 
> -DartifactId=myjar -Dversion=1.0 -Dpackaging=jar
> 
> Then, in your pom.xml you would refer to this new
> artifact/dependency 
> like this:  (using the same example)
> 
> <dependency>
>     <groupId>myjar</groupId>
>     <artifactId>myjar</artifactId>
>     <version>1.0</version>
> </dependency>
> 
> Then, your build will pick up the jar you want it to use.
> Good luck!
> Dave
> 
> 
> 
> Petr V. wrote:
> > Thanks Dave for such a quick response.
> >
> > I started from jar files w/o pom files. So I went to
> maven repository web site http://www.mvnrepository.com/ and
> search for those jars. Some of those jars were available
> under different groups ids but same artifact id like
> saax-api-1.3.jar is found under javax.xml as javax.xml.soap
> as well. I picked the most appropriate one using educated
> guesses. May be that is causing some trouble. How can I find
> out the correct version of group ids and artifacts ids :-(
> >
> > Thanks,
> >
> > Petr
> >
> >
> > --- On Wed, 10/29/08, David C. Hicks
> <dh...@i-hicks.org> wrote:
> >
> >   
> >> From: David C. Hicks <dh...@i-hicks.org>
> >> Subject: Re: How to convert Eclipse project to
> maven project
> >> To: "Maven Users List"
> <us...@maven.apache.org>
> >> Date: Wednesday, October 29, 2008, 7:01 AM
> >> Unless you specified the proper versions and
> classifiers for
> >> your 
> >> dependencies, then Maven is likely to find the
> ones that
> >> are available 
> >> in the primary repository.  Assuming that you used
> Maven to
> >> install your 
> >> jar files into your local repository, make sure
> that your
> >> pom.xml 
> >> specifies the same groupId, artifactId, and
> version that
> >> you used when 
> >> you did that installation.  Otherwise, Maven
> won't find
> >> them and will go 
> >> looking for anything else that matches your
> pom.xml.
> >>
> >> I hope that's helpful.
> >> Dave
> >>
> >>
> >> Petr V. wrote:
> >>     
> >>> I have simple web services demo which I
> created in
> >>>       
> >> Eclipse and added external jar files to project. I
> am able
> >> to run it successfully unit tests in eclipse IDE.
> >>     
> >>> Now I have moved the code to maven project and
> added
> >>>       
> >> dependencies tho those jar files in my pom file.
> And now the
> >> maven project fails complaining
> >> "java.lang.NoClassDefFoundError:
> >>
> com/sun/xml/fastinfoset/stax/StAXDocumentParser". 
> >>     
> >>> I installed all jars files manually in my
> totally new
> >>>       
> >> maven repo but maven first downloads pom files for
> those
> >> manually installed jars and then download other
> jar files
> >> which are defined as dependencies in those new
> downloaded
> >> pom files. I do not want any of those newly
> downloaded jar
> >> files. I know my manually installed jar files are
> good
> >> enough to run the project (as shown in eclipse)
> but maven is
> >> doing some thing stupid amd making my project fail
> at run
> >> time complaining of missing class files.
> >>     
> >>> How could I resolve this issue in most
> cleanest way.I
> >>>       
> >> hope that I am able to explain problem clearly.
> >>     
> >>> Any help would be really appreciated.
> >>>
> >>> Thanks,
> >>>
> >>> Petr
> >>>
> >>>  
> >>>
> >>>
> >>>
> >>>
> >>>       
> >>>   
> >>>       
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail:
> >> users-help@maven.apache.org
> >>     
> >
> >
> >       
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> > For additional commands, e-mail:
> users-help@maven.apache.org
> >
> >   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org


      

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


Re: How to convert Eclipse project to maven project

Posted by "David C. Hicks" <dh...@i-hicks.org>.
Ah.  I see where you went wrong.  It's not even that complicated.  Use 
the following command to add your jar files to your local repository:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> 
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

Example:  mvn install:install-file -Dfile=myjar.jar -DgroupId=myjar 
-DartifactId=myjar -Dversion=1.0 -Dpackaging=jar

Then, in your pom.xml you would refer to this new artifact/dependency 
like this:  (using the same example)

<dependency>
    <groupId>myjar</groupId>
    <artifactId>myjar</artifactId>
    <version>1.0</version>
</dependency>

Then, your build will pick up the jar you want it to use.
Good luck!
Dave



Petr V. wrote:
> Thanks Dave for such a quick response.
>
> I started from jar files w/o pom files. So I went to maven repository web site http://www.mvnrepository.com/ and search for those jars. Some of those jars were available under different groups ids but same artifact id like saax-api-1.3.jar is found under javax.xml as javax.xml.soap as well. I picked the most appropriate one using educated guesses. May be that is causing some trouble. How can I find out the correct version of group ids and artifacts ids :-(
>
> Thanks,
>
> Petr
>
>
> --- On Wed, 10/29/08, David C. Hicks <dh...@i-hicks.org> wrote:
>
>   
>> From: David C. Hicks <dh...@i-hicks.org>
>> Subject: Re: How to convert Eclipse project to maven project
>> To: "Maven Users List" <us...@maven.apache.org>
>> Date: Wednesday, October 29, 2008, 7:01 AM
>> Unless you specified the proper versions and classifiers for
>> your 
>> dependencies, then Maven is likely to find the ones that
>> are available 
>> in the primary repository.  Assuming that you used Maven to
>> install your 
>> jar files into your local repository, make sure that your
>> pom.xml 
>> specifies the same groupId, artifactId, and version that
>> you used when 
>> you did that installation.  Otherwise, Maven won't find
>> them and will go 
>> looking for anything else that matches your pom.xml.
>>
>> I hope that's helpful.
>> Dave
>>
>>
>> Petr V. wrote:
>>     
>>> I have simple web services demo which I created in
>>>       
>> Eclipse and added external jar files to project. I am able
>> to run it successfully unit tests in eclipse IDE.
>>     
>>> Now I have moved the code to maven project and added
>>>       
>> dependencies tho those jar files in my pom file. And now the
>> maven project fails complaining
>> "java.lang.NoClassDefFoundError:
>> com/sun/xml/fastinfoset/stax/StAXDocumentParser". 
>>     
>>> I installed all jars files manually in my totally new
>>>       
>> maven repo but maven first downloads pom files for those
>> manually installed jars and then download other jar files
>> which are defined as dependencies in those new downloaded
>> pom files. I do not want any of those newly downloaded jar
>> files. I know my manually installed jar files are good
>> enough to run the project (as shown in eclipse) but maven is
>> doing some thing stupid amd making my project fail at run
>> time complaining of missing class files.
>>     
>>> How could I resolve this issue in most cleanest way.I
>>>       
>> hope that I am able to explain problem clearly.
>>     
>>> Any help would be really appreciated.
>>>
>>> Thanks,
>>>
>>> Petr
>>>
>>>  
>>>
>>>
>>>
>>>
>>>       
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail:
>> users-help@maven.apache.org
>>     
>
>
>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   

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


Re: How to convert Eclipse project to maven project

Posted by "Petr V." <gr...@yahoo.com>.
Thanks Dave for such a quick response.

I started from jar files w/o pom files. So I went to maven repository web site http://www.mvnrepository.com/ and search for those jars. Some of those jars were available under different groups ids but same artifact id like saax-api-1.3.jar is found under javax.xml as javax.xml.soap as well. I picked the most appropriate one using educated guesses. May be that is causing some trouble. How can I find out the correct version of group ids and artifacts ids :-(

Thanks,

Petr


--- On Wed, 10/29/08, David C. Hicks <dh...@i-hicks.org> wrote:

> From: David C. Hicks <dh...@i-hicks.org>
> Subject: Re: How to convert Eclipse project to maven project
> To: "Maven Users List" <us...@maven.apache.org>
> Date: Wednesday, October 29, 2008, 7:01 AM
> Unless you specified the proper versions and classifiers for
> your 
> dependencies, then Maven is likely to find the ones that
> are available 
> in the primary repository.  Assuming that you used Maven to
> install your 
> jar files into your local repository, make sure that your
> pom.xml 
> specifies the same groupId, artifactId, and version that
> you used when 
> you did that installation.  Otherwise, Maven won't find
> them and will go 
> looking for anything else that matches your pom.xml.
> 
> I hope that's helpful.
> Dave
> 
> 
> Petr V. wrote:
> > I have simple web services demo which I created in
> Eclipse and added external jar files to project. I am able
> to run it successfully unit tests in eclipse IDE.
> >
> > Now I have moved the code to maven project and added
> dependencies tho those jar files in my pom file. And now the
> maven project fails complaining
> "java.lang.NoClassDefFoundError:
> com/sun/xml/fastinfoset/stax/StAXDocumentParser". 
> >
> > I installed all jars files manually in my totally new
> maven repo but maven first downloads pom files for those
> manually installed jars and then download other jar files
> which are defined as dependencies in those new downloaded
> pom files. I do not want any of those newly downloaded jar
> files. I know my manually installed jar files are good
> enough to run the project (as shown in eclipse) but maven is
> doing some thing stupid amd making my project fail at run
> time complaining of missing class files.
> >
> > How could I resolve this issue in most cleanest way.I
> hope that I am able to explain problem clearly.
> >
> > Any help would be really appreciated.
> >
> > Thanks,
> >
> > Petr
> >
> >  
> >
> >
> >
> >
> >       
> >   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org


      

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


Re: How to convert Eclipse project to maven project

Posted by "David C. Hicks" <dh...@i-hicks.org>.
Unless you specified the proper versions and classifiers for your 
dependencies, then Maven is likely to find the ones that are available 
in the primary repository.  Assuming that you used Maven to install your 
jar files into your local repository, make sure that your pom.xml 
specifies the same groupId, artifactId, and version that you used when 
you did that installation.  Otherwise, Maven won't find them and will go 
looking for anything else that matches your pom.xml.

I hope that's helpful.
Dave


Petr V. wrote:
> I have simple web services demo which I created in Eclipse and added external jar files to project. I am able to run it successfully unit tests in eclipse IDE.
>
> Now I have moved the code to maven project and added dependencies tho those jar files in my pom file. And now the maven project fails complaining "java.lang.NoClassDefFoundError: com/sun/xml/fastinfoset/stax/StAXDocumentParser". 
>
> I installed all jars files manually in my totally new maven repo but maven first downloads pom files for those manually installed jars and then download other jar files which are defined as dependencies in those new downloaded pom files. I do not want any of those newly downloaded jar files. I know my manually installed jar files are good enough to run the project (as shown in eclipse) but maven is doing some thing stupid amd making my project fail at run time complaining of missing class files.
>
> How could I resolve this issue in most cleanest way.I hope that I am able to explain problem clearly.
>
> Any help would be really appreciated.
>
> Thanks,
>
> Petr
>
>  
>
>
>
>
>       
>   

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