You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Connor Barry (JIRA)" <ji...@codehaus.org> on 2008/11/29 08:38:20 UTC

[jira] Commented: (MECLIPSE-165) Ability to exclude filtered resources from eclipse's source directories

    [ http://jira.codehaus.org/browse/MECLIPSE-165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=155797#action_155797 ] 

Connor Barry commented on MECLIPSE-165:
---------------------------------------

Any updates yet? This is really a crucial fix for anybody using filtered resources, which is a basic requirement of a lot of projects...

My workaround is to have a shell script that calls the maven goal, and additionally an ant script that modifies the resulting .classpath file to exclude ALL filtered resources, not only the **/*.java files. There's two regexes to account for the two possible attribute orders, which are seemingly random; just a hack, I'm sure there's a better way.

----------------------------- eclipse-config.bat:
@echo off
setlocal

set _REALPATH=%~dp0
cd %_REALPATH%

cls
call %M2_HOME%/bin/mvn eclipse:clean eclipse:eclipse
call %ANT_HOME%/bin/ant fix-classpath
pause

----------------------------- build.xml   (add a bogus env target if necessary):

<?xml version="1.0"?>
<project name="xxx" default="env">
<target name="fix-classpath">
		<echo message="Fixing the WTP settings..." />
		<replaceregexp file=".classpath" byline="true">
			<regexp pattern='(.*)excluding="\*\*/\*\.java"(.*)path="src/main/resources-filtered"(.*)' />
			<substitution expression='\1excluding="**/*"\2path="src/main/resources-filtered"\3' />
		</replaceregexp>
		<replaceregexp file=".classpath" byline="true">
			<regexp pattern='(.*)path="src/main/resources-filtered"(.*)excluding="\*\*/\*\.java"(.*)' />
			<substitution expression='\1excluding="**/*"\2path="src/main/resources-filtered"\3' />
		</replaceregexp>
	</target>
</project>


> Ability to exclude filtered resources from eclipse's source directories
> -----------------------------------------------------------------------
>
>                 Key: MECLIPSE-165
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-165
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: New Feature
>          Components: PDE support
>    Affects Versions: 2.3
>            Reporter: Cédric Vidal
>            Assignee: Brian Fox
>         Attachments: MECLIPSE-165.patch
>
>
> Resources should be in the classpath from Eclipse's point of view because they end up being in the classpath from Maven 2's point of view, but whenever resources are marked as being filtered by M2, Eclipse puts them unfiltered in the classpath thus introducing an inconsistency between Maven 2 and Eclipse.
> Whether or not to include filtered resource directories in eclipse's sources directories is therefore a real dilemna. While I'm sure a consistent solution to this dilemna will eventually be found, it would be great to let the user choose what to do in the meantime.
> The attached patch adresses this issue by adding a parameter, 'excludeFilteredResourcesFromSourceDirs', which when set to true prevents filtered resource directories from being added to eclipse's source directories. The parameter defaults to false to avoid changing current projects' behavior.
> Regards,
> Cédric Vidal
> http://www.B-Process.com
> PS: This parameter could be overriden on a per resource directory basis as mentionned in MECLIPSE-162. This is not adressed by the attached patch though

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira