[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] Target folder outside project's folder -> exception
|
Ok
Is there some instructions on how to run the tests (the ones in your other git repo )?
I generated the patch using git format-patch so I thought it would be correct....
Kind regards
Lucas
3 sep 2013 kl. 17:16 skrev Igor Fedorenko <igor@xxxxxxxxxxxxxx>:
> Lucas,
>
> If you'd like to see this patch integrated in m2e, you'd need to submit
> it as git-format-patch formatted patches attached to eclipse bugzilla
> and must have IP-raleted statement in the commit comment (see [1] for
> details).
>
> You will also need to provide corresponding automated regression test.
>
> [1] http://wiki.eclipse.org/M2E_Development_Environment
>
> --
> Regards,
> Igor
>
> On 2013-09-03 11:02 AM, Lucas Persson wrote:
>> Hi Igor
>>
>> Here is a patch that will support to have the build folder outside the project's folder.
>> For sure it will fix the exception at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:71).
>>
>> I also updated the AbstractClasspathProvider in the M2E JDT plugin so that JUnit works in such cases.
>>
>> The patch (attached) is based on a branch on release tag of "releases/1.4/1.4.0.20130601-0317"
>>
>> By this patch the bug "<https://bugs.eclipse.org/bugs/show_bug.cgi?id=361824> -Regression[MNGECLIPSE-767]Path
>> must include project and resource name: /" will be fixed.
>>
>> Also if this is added the the root pom.xml
>> <pluginExecution>
>> <pluginExecutionFilter>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <versionRange>[2.0,)</versionRange>
>> <goals>
>> <goal>compile</goal>
>> <goal>testCompile</goal>
>> </goals>
>> <parameters>
>> <compilerId>javac</compilerId>
>> </parameters>
>> </pluginExecutionFilter>
>> <action>
>> <ignore></ignore>
>> </action>
>> </pluginExecution>
>>
>> and given that the .classpatch and .project looks OK
>> It will be possible to have the build folder outside the project's folder.
>> (As mentioned in the above bug)
>> The support will not be that smooth since the .classpath must be correct for the beginning instead of generated by m2e.
>> But it will work.
>> Typical .classpath and .project
>> <classpath>
>> <classpathentry kind="src" path="src/main/java" />
>> <classpathentry kind="src" path="src/main/resources" />
>> <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
>> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
>> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
>> <classpathentry kind="output" path="target/classes"/>
>> </classpath>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <projectDescription>
>> <name>my-jar-artifactId1</name>
>> <comment />
>> <projects />
>> <buildSpec>
>> <buildCommand>
>> <name>org.eclipse.jdt.core.javabuilder</name>
>> <arguments />
>> </buildCommand>
>> <buildCommand>
>> <name>org.eclipse.m2e.core.maven2Builder</name>
>> <arguments />
>> </buildCommand>
>> </buildSpec>
>> <natures>
>> <nature>org.eclipse.jdt.core.javanature</nature>
>> <nature>org.eclipse.m2e.core.maven2Nature</nature>
>> </natures>
>> <linkedResources>
>> <link>
>> <name>target</name>
>> <type>2</type>
>> <locationURI>M2_TARGET/org.example.groupId1/my-jar-artifactId1/target</locationURI>
>> </link>
>> </linkedResources>
>> </projectDescription>
>>
>> M2_TARGET must be defined in the workspace and point to the top "target" folder outside the SCM area.
>>
>>
>>
>> Thanks
>> Lucas
>>
>>
>>
>>
>>
>>
>>
>>
>> 27 aug 2013 kl. 14:10 skrev Igor Fedorenko:
>>
>>> I think it is reasonable to patch AbstractLifecycleMapping#configure to
>>> tolerate projectFacade.getProjectRelativePath returning null. I believe
>>> this was the indent of the code, so the exception you get is a bug.
>>> Please provide a quality patch (including regression tests) and I'll
>>> review it.
>>>
>>> To use different AbstractLifecycleMapping implementation, you need to
>>> 1. define org.eclipse.m2e.core.lifecycleMappings extension
>>> 2. in (parent) pom.xml specific m2e lifecycle mapping configuration
>>>
>>> <pluginManagement>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.eclipse.m2e</groupId>
>>> <artifactId>lifecycle-mapping</artifactId>
>>> <version>1.0.0</version>
>>> <configuration>
>>> <lifecycleMappingMetadata>
>>> <lifecycleMappings>
>>> <lifecycleMapping>
>>> <packagingType>...</packagingType>
>>> <lifecycleMappingId>...</lifecycleMappingId>
>>> </lifecycleMapping>
>>> </lifecycleMappings>
>>> </lifecycleMappingMetadata>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> </pluginManagement>
>>>
>>> You will have to define mapping for all packaging types you use in your
>>> project.
>>>
>>> --
>>> Regards,
>>> Igor
>>>
>>> On 2013-08-27 4:42 AM, Lucas Persson wrote:
>>>> Hi
>>>>
>>>> I have defined that the target folder (and target/classes) shall be
>>>> outside the project's folder.
>>>> The reason to have it like this is that I am using a proprietary SCM
>>>> which do not allow write access unless a file is checkout out.
>>>> And alas it does not have any type of "ignore" filter.
>>>>
>>>> The thing is that every time I do "Maven->Update Project..." it fails
>>>> like this:
>>>>
>>>> An internal error occurred during: "Updating Maven Project".
>>>> Path must include project and resource name: /tiget-api
>>>>
>>>> java.lang.IllegalArgumentException: Path must include project and
>>>> resource name: /tiget-api
>>>> at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
>>>> at
>>>> org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
>>>> at
>>>> org.eclipse.core.internal.resources.Container.getFolder(Container.java:222)
>>>> at
>>>> org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:71)
>>>>
>>>>
>>>> I am not sure what m2e does here but I guess it is updating the output
>>>> folder (among other things)
>>>>
>>>> The code that sort of breaks is this:
>>>> org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping,
>>>> method "configure()"
>>>>
>>>> /**
>>>> * Calls #configure method of all registered project configurators
>>>> */
>>>> public void configure(ProjectConfigurationRequest request,
>>>> IProgressMonitor mon) throws CoreException {
>>>> final SubMonitor monitor = SubMonitor.convert(mon, 5);
>>>> try {
>>>>
>>>> MavenPlugin.getProjectConfigurationManager().addMavenBuilder(request.getProject(),
>>>> null /*description*/,
>>>> monitor.newChild(1));
>>>>
>>>> IMavenProjectFacade projectFacade = request.getMavenProjectFacade();
>>>> MavenProject mavenProject = request.getMavenProject();
>>>>
>>>> Build build = mavenProject.getBuild();
>>>> if(build != null) {
>>>> String directory = build.getDirectory();
>>>> if(directory != null) {
>>>> *IContainer container =
>>>> projectFacade.getProject().getFolder(projectFacade.getProjectRelativePath(directory));*
>>>> if(container != null) {
>>>> if(!container.exists() && container instanceof IFolder) {
>>>> M2EUtils.createFolder((IFolder) container, true,
>>>> monitor.newChild(1));
>>>> } else {
>>>> container.setDerived(true, monitor.newChild(1));
>>>> }
>>>> }
>>>> }
>>>> }
>>>>
>>>> It seems that *projectFacade.getProjectRelativePath(directory) *returns
>>>> null when the pom.xml defines that the build folder is outside the
>>>> project's folder.
>>>> and that leads to exception in *projectFacade.getProject().getFolder()
>>>> *instead of returning a NULL IContainer (which the code seems to assume).
>>>>
>>>>
>>>> Is there a way to
>>>> "override" org.eclipse.m2e.jdt.internal.JarLifecycleMapping so I can
>>>> make my own patched version?
>>>> It seems to be a bug on this: *Bug 361824*
>>>> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=361824> -Regression[MNGECLIPSE-767]Path
>>>> must include project and resource name: /
>>>> (when this is fixed I will have to implement a project configurator that
>>>> fixes the build folder anyway but the above issue is blocking me since
>>>> project configurations are called further down in the method.)
>>>>
>>>> I am using m2e version 1.4.0_20130601-0317
>>>>
>>>> Thanks
>>>> Lucas
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Lucas Persson | Principal Member of Technical Staff
>>>> Phone: +4684773644 | | | Mobile: +46730946656
>>>> Oracle Communications Platform
>>>> ORACLE Sweden | Söder Mälarstrand 29, 6 tr | 118 25 Stockholm
>>>>
>>>> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no
>>>> <http://reg.no>. 556254-6746
>>>> Oracle is committed to developing practices and products that help
>>>> protect the environment
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> m2e-dev mailing list
>>>> m2e-dev@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>>> _______________________________________________
>>> m2e-dev mailing list
>>> m2e-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>>
>>
>>
>>
>> Lucas Persson | Principal Member of Technical Staff
>> Phone: +4684773644 | | | Mobile: +46730946656
>> Oracle Communications Platform
>> ORACLE Sweden | Söder Mälarstrand 29, 6 tr | 118 25 Stockholm
>>
>> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
>>
>>
>>
>> Oracle is committed to developing practices and products that help protect the environment
>>
>>
>>
>> _______________________________________________
>> m2e-dev mailing list
>> m2e-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev