You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Rahul <ra...@clear.net.nz> on 2005/06/10 16:41:49 UTC

Project import errors with eclipse:eclipse plugin

Hi,

Attached is a log that I have copied from the Eclipse workbench error 
view for the Maven SVN trunk projects that I attempted to import into 
Eclipse.

Some notes on project import that might help to refine this plugin:
1) Eclipse (I am using 3.1 RC1) does not traverses all sub-folders when 
provided with a root directory to import projects from. It stops 
traversing the sub-folders when it encounters first project definition 
(.project) in a parent folder. I have posted a related message on 
Eclipse newsgroup as well to explain this.
http://www.eclipse.org/newsportal/article.php?id=40947&group=eclipse.platform#40947

A useful resource to refer to might be the following Eclipse plugin that 
traverses all the folders:
http://eclipse-tools.sourceforge.net/projecttransfer/download.html

2) Eclipse project definitions are generated for projects with a pom.xml 
whether or not these respect rules for nested projects. I think these 
should only be generated for projects with Java sources (and not exclude 
any java templates) or directory structure restructured where we might 
run into situations resulting in nested projects or uncompilable projects.

3) Classpath variables(M2_REPO) are missing when the eclipse:eclipse 
build is run. A.t.m I am not sure (too sleepy to think!) how we could 
set up these variable (may be generate preferences) achieved, but in 
case not, it might be best to resolve the local repository and refer it 
using absolute path.

Having said that, the plugin is a nice one to have and I am sure will 
serve a better purpose if we can hone it further. As ever - happy to 
provide inputs or contribute in any way I can (I can see myself working 
on something similar in a few weeks down the line ;-) in any case!)

Look forward to thoughts/ideas/suggestions...

Cheers,
Rahul

Re: Project import errors with eclipse:eclipse plugin

Posted by Rahul <ra...@clear.net.nz>.
Brett Porter wrote:

>
>>
>> The "template processor" take all resource files and replace in them 
>> all  parameter like @package@. It don't know if the file is a text 
>> file, a java source file or a c# source file. We could remove .tpl 
>> extension, but I don't like it.
>>
>> Brett?
>
>
> I'm confused. The files don't have a tpl extension as it is.
>
> I like it with the extensions they have now. If they are being picked 
> up as source when they are not really in the source tree, that is the 
> problem more than anything else. Is it because resources are added as 
> source folders in eclipse?
>
> - Brett

Yep, the files don't have .tpl extension, that was just an example for a 
possible workaround that the folder they are in shouldn't be picked up 
as source folder. Yep, the compile errors are 'cos they are being added 
as source folders in Eclipse.

Cheers,
Rahul


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


Re: Project import errors with eclipse:eclipse plugin

Posted by Brett Porter <br...@apache.org>.
>
> The "template processor" take all resource files and replace in them 
> all  parameter like @package@. It don't know if the file is a text 
> file, a java source file or a c# source file. We could remove .tpl 
> extension, but I don't like it.
>
> Brett?

I'm confused. The files don't have a tpl extension as it is.

I like it with the extensions they have now. If they are being picked up 
as source when they are not really in the source tree, that is the 
problem more than anything else. Is it because resources are added as 
source folders in eclipse?

- Brett

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


Re: Project import errors with eclipse:eclipse plugin

Posted by Emmanuel Venisse <em...@venisse.net>.

Rahul wrote:
> Emmanuel Venisse wrote:
> 
>>>
>>>
>>> Project: maven-archetype-quickstart
>>> - File App.java sitting under 
>>> srcmain/resources/archetype-resources/src/main/java/ is not 
>>> compilable. - The package reference in the source file is '$package'. 
>>> I believe the file is a template, so might
>>>   be an idea not to resolve it as a Java source or appropriate 
>>> exclusion filters to be set up in the build path. - Same deal as 
>>> above with file AppTest.java under 
>>> src/main/resources/archetype-resources/src/test/java
>>
>>
>>
>> It isn't a java source but a template text file (with java code). Do 
>> you have a fix?
>>
> Would it be better to have these named with a different extension other 
> than .java (may be .java.tpl for instance) so atleast these are not 
> detected as compilable java sources? Do these need to stay as .java as 
> to be consumed by the template processor/handler etc?

The "template processor" take all resource files and replace in them all 
  parameter like @package@. It don't know if the file is a text file, a 
java source file or a c# source file. We could remove .tpl extension, 
but I don't like it.

Brett?

> 
> Cheers,
> Rahul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 
> 


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


Re: Project import errors with eclipse:eclipse plugin

Posted by Rahul <ra...@clear.net.nz>.
Emmanuel Venisse wrote:

>>
>>
>> Project: maven-archetype-quickstart
>> - File App.java sitting under 
>> srcmain/resources/archetype-resources/src/main/java/ is not 
>> compilable. - The package reference in the source file is '$package'. 
>> I believe the file is a template, so might
>>   be an idea not to resolve it as a Java source or appropriate 
>> exclusion filters to be set up in the build path. - Same deal as 
>> above with file AppTest.java under 
>> src/main/resources/archetype-resources/src/test/java
>
>
> It isn't a java source but a template text file (with java code). Do 
> you have a fix?
>
Would it be better to have these named with a different extension other 
than .java (may be .java.tpl for instance) so atleast these are not 
detected as compilable java sources? Do these need to stay as .java as 
to be consumed by the template processor/handler etc?

Cheers,
Rahul


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


Re: Project import errors with eclipse:eclipse plugin

Posted by Emmanuel Venisse <em...@venisse.net>.

Rahul wrote:
> Hi,
> 
>>> Some notes on project import that might help to refine this plugin:
>>> 1) Eclipse (I am using 3.1 RC1) does not traverses all sub-folders 
>>> when provided with a root directory to import projects from. It stops 
>>> traversing the sub-folders when it encounters first project 
>>> definition (.project) in a parent folder. I have posted a related 
>>> message on Eclipse newsgroup as well to explain this.
>>> http://www.eclipse.org/newsportal/article.php?id=40947&group=eclipse.platform#40947 
>>>
>>>
>>> A useful resource to refer to might be the following Eclipse plugin 
>>> that traverses all the folders:
>>> http://eclipse-tools.sourceforge.net/projecttransfer/download.html
>>
>>
>>
>> I think it's a bad idea to have eclipse projects under another one. If 
>> you create sub-projects into sub-folders only for pom project, we will 
>> not have problems because eclipse plugin generate files only for java 
>> projetcs and not for pom projects. It's what we have for m2 project.
>>
> Yep, I agree its a bad idea but I noticed project definitions being 
> generated such that to result in nested projects. Anyway, this seems to 
> work fine with latest checkout, so thats great!
> 
>>>
>>> 2) Eclipse project definitions are generated for projects with a 
>>> pom.xml whether or not these respect rules for nested projects. I 
>>> think these should only be generated for projects with Java sources 
>>> (and not exclude any java templates) or directory structure 
>>> restructured where we might run into situations resulting in nested 
>>> projects or uncompilable projects.
>>
>>
>>
>> The actual svn version of eclipse plugin generate .project and 
>> .classpath files only for project with a packaging tag != pom
> 
> 
> Yeah, as I said these are generated fine now. I still have a few build 
> errors showing up in Eclipse. Attached are a few notes on the errors 
> found and ones that I could get around (updating classpath etc).
> 
> Thanks,
> 
> Rahul
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______
>  NOTES
> -------
> 
> Project: maven-plugin-tools-java
> - Resources under srctest/resources/ folder are not resolved to appropriate paths.
> - Think this is b'cos the 'source' folder sitting underneath above said folder does not 
>   follow convention of being named as 'src' (is it?)
> - WORKAROUND: Adding this folder as a source folder for the project fixes it. 
> - SUGGESTED: might be an idea to rename 'source' to 'src'
> 
> 
> Project: maven-artifact-ant 
> - org.apache.maven.artifact.ant.Pom.java has following unresolved import
>   import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
> - This need to use plexus-utils-1.0-alpha-3.jar 

Fixed.

> 
> 
> Project: maven-archetype-quickstart
> - File App.java sitting under srcmain/resources/archetype-resources/src/main/java/ is not compilable. 
> - The package reference in the source file is '$package'. I believe the file is a template, so might
>   be an idea not to resolve it as a Java source or appropriate exclusion filters to be set up in the build path. 
> - Same deal as above with file AppTest.java under src/main/resources/archetype-resources/src/test/java

It isn't a java source but a template text file (with java code). Do you 
have a fix?

> 
> 
> Project: maven-archetype-mojo
> - Same prob as in project maven-archetype-quickstart with MyMojo.java
> - .classpath missing reference to M2_REPO/org/apache/maven/maven-plugin-api/2.0-SNAPSHOT/maven-plugin-api-2.0-SNAPSHOT.jar
> 
> 
> Project: maven-archetype-marmalade-mojo
> - Same prob as in project maven-archetype-quickstart with files CopyFileTag.java and MyMojoTagLibrary.java
> - .classpath missing reference to M2_REPO/marmalade/marmalade-core/1.0-alpha-3/marmalade-core-1.0-alpha-3.jar
> 

These projects contains only templates, so they don't need dependencies.


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


Re: Project import errors with eclipse:eclipse plugin

Posted by Rahul <ra...@clear.net.nz>.
Hi,

>> Some notes on project import that might help to refine this plugin:
>> 1) Eclipse (I am using 3.1 RC1) does not traverses all sub-folders 
>> when provided with a root directory to import projects from. It stops 
>> traversing the sub-folders when it encounters first project 
>> definition (.project) in a parent folder. I have posted a related 
>> message on Eclipse newsgroup as well to explain this.
>> http://www.eclipse.org/newsportal/article.php?id=40947&group=eclipse.platform#40947 
>>
>>
>> A useful resource to refer to might be the following Eclipse plugin 
>> that traverses all the folders:
>> http://eclipse-tools.sourceforge.net/projecttransfer/download.html
>
>
> I think it's a bad idea to have eclipse projects under another one. If 
> you create sub-projects into sub-folders only for pom project, we will 
> not have problems because eclipse plugin generate files only for java 
> projetcs and not for pom projects. It's what we have for m2 project.
>
Yep, I agree its a bad idea but I noticed project definitions being 
generated such that to result in nested projects. Anyway, this seems to 
work fine with latest checkout, so thats great!

>>
>> 2) Eclipse project definitions are generated for projects with a 
>> pom.xml whether or not these respect rules for nested projects. I 
>> think these should only be generated for projects with Java sources 
>> (and not exclude any java templates) or directory structure 
>> restructured where we might run into situations resulting in nested 
>> projects or uncompilable projects.
>
>
> The actual svn version of eclipse plugin generate .project and 
> .classpath files only for project with a packaging tag != pom

Yeah, as I said these are generated fine now. I still have a few build 
errors showing up in Eclipse. Attached are a few notes on the errors 
found and ones that I could get around (updating classpath etc).

Thanks,

Rahul



Re: Project import errors with eclipse:eclipse plugin

Posted by Emmanuel Venisse <em...@venisse.net>.

Rahul wrote:
> 
> Hi,
> 
> Attached is a log that I have copied from the Eclipse workbench error 
> view for the Maven SVN trunk projects that I attempted to import into 
> Eclipse.

I am using 3.1M6 and I don't have this errors

> 
> Some notes on project import that might help to refine this plugin:
> 1) Eclipse (I am using 3.1 RC1) does not traverses all sub-folders when 
> provided with a root directory to import projects from. It stops 
> traversing the sub-folders when it encounters first project definition 
> (.project) in a parent folder. I have posted a related message on 
> Eclipse newsgroup as well to explain this.
> http://www.eclipse.org/newsportal/article.php?id=40947&group=eclipse.platform#40947 
> 
> 
> A useful resource to refer to might be the following Eclipse plugin that 
> traverses all the folders:
> http://eclipse-tools.sourceforge.net/projecttransfer/download.html

I think it's a bad idea to have eclipse projects under another one. If 
you create sub-projects into sub-folders only for pom project, we will 
not have problems because eclipse plugin generate files only for java 
projetcs and not for pom projects. It's what we have for m2 project.

> 
> 2) Eclipse project definitions are generated for projects with a pom.xml 
> whether or not these respect rules for nested projects. I think these 
> should only be generated for projects with Java sources (and not exclude 
> any java templates) or directory structure restructured where we might 
> run into situations resulting in nested projects or uncompilable projects.

The actual svn version of eclipse plugin generate .project and 
.classpath files only for project with a packaging tag != pom

> 
> 3) Classpath variables(M2_REPO) are missing when the eclipse:eclipse 
> build is run. A.t.m I am not sure (too sleepy to think!) how we could 
> set up these variable (may be generate preferences) achieved, but in 
> case not, it might be best to resolve the local repository and refer it 
> using absolute path.

You need to add this :

org.eclipse.jdt.core.classpathVariable.M2_REPO=E\:/maven/repository

in 
workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs

I think we must do a mojo for add this line in this file

> 
> Having said that, the plugin is a nice one to have and I am sure will 
> serve a better purpose if we can hone it further. As ever - happy to 
> provide inputs or contribute in any way I can (I can see myself working 
> on something similar in a few weeks down the line ;-) in any case!)
> 
> Look forward to thoughts/ideas/suggestions...
> 
> Cheers,
> Rahul
> 
> 
> ------------------------------------------------------------------------
> 
> Severity	Description	Resource	In Folder	Location	Creation Time
> 2	The declared package does not match the expected package archetype-resources.src.main.java	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 1	11 June 2005 01:57:08
> 2	The import org.codehaus cannot be resolved	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 19	11 June 2005 01:57:08
> 2	The import org.codehaus cannot be resolved	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 20	11 June 2005 01:57:08
> 2	The import org.codehaus cannot be resolved	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 21	11 June 2005 01:57:08
> 2	AbstractMarmaladeTag cannot be resolved to a type	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 27	11 June 2005 01:57:08
> 2	MarmaladeExecutionContext cannot be resolved to a type	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 30	11 June 2005 01:57:08
> 2	MarmaladeExecutionException cannot be resolved to a type	CopyFileTag.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 31	11 June 2005 01:57:08
> 2	The declared package does not match the expected package archetype-resources.src.main.java	MyMojoTagLibrary.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 1	11 June 2005 01:57:08
> 2	The import org.codehaus cannot be resolved	MyMojoTagLibrary.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 19	11 June 2005 01:57:08
> 2	AbstractMarmaladeTagLibrary cannot be resolved to a type	MyMojoTagLibrary.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 25	11 June 2005 01:57:08
> 2	The method registerTag(String, Class) is undefined for the type MyMojoTagLibrary	MyMojoTagLibrary.java	maven-archetype-marmalade-mojo/src/main/resources/archetype-resources/src/main/java	line 30	11 June 2005 01:57:08
> 2	The declared package does not match the expected package archetype-resources.src.main.java	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 1	11 June 2005 01:57:10
> 2	The import org.apache cannot be resolved	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 19	11 June 2005 01:57:10
> 2	The import org.apache cannot be resolved	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 20	11 June 2005 01:57:10
> 2	AbstractMojo cannot be resolved to a type	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 34	11 June 2005 01:57:10
> 2	MojoExecutionException cannot be resolved to a type	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 44	11 June 2005 01:57:10
> 2	MojoExecutionException cannot be resolved to a type	MyMojo.java	maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java	line 64	11 June 2005 01:57:10
> 2	The declared package does not match the expected package archetype-resources.src.main.java	App.java	maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java	line 1	11 June 2005 01:57:12
> 2	The declared package does not match the expected package archetype-resources.src.test.java	AppTest.java	maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java	line 1	11 June 2005 01:57:12
> 2	ReflectionValueExtractor cannot be resolved	Pom.java	maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant	line 326	11 June 2005 01:57:30
> 2	The declared package does not match the expected package source	JavaExtractorTestOne.java	maven-plugin-tools-java/src/test/resources/source	line 1	11 June 2005 01:58:45
> 2	The declared package does not match the expected package source	JavaExtractorTestTwo.java	maven-plugin-tools-java/src/test/resources/source	line 1	11 June 2005 01:58:45
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


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