You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Chris Tomlinson <ch...@gmail.com> on 2017/09/11 17:47:27 UTC

eclipse and shaded guava?

Hi,

I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up properly with imports like:

> import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
> import org.apache.jena.ext.com.google.common.cache.CacheStats ;

I "git clone" jena and

    mvn clean install
    mvn eclipse:eclipse

and then import the various submodules as existing maven projects into eclipse. Once the imports complete there are a few of the submodules with syntax errors in eclipse centered on the shaded guava. The projects with errors all have

    jena-shaded-guava

as a project dependency in the .project and also a library reference to M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.

The jena repo and submodules build and test fine from the command line.

I’ve run maven update project on all of the jena projects and once the “update project” process completes the errors are cleared (a result of “clean projects” being checked) from all of the projects and then during the “building workspace” process the errors reappear one-by-one as the workspace is rebuilt.

I appreciate any ideas about what I’m stumbling on.

Thanks,
Chris



Re: eclipse and shaded guava?

Posted by Stian Soiland-Reyes <st...@apache.org>.
A workaround would be to only update the <dependency> version on
jena-shaded-guava when it needs to be changed, so the git SNAPSHOT master
could depend on the previous Jena-release of jena-guava from Maven Central.
One could then remove that module from the default profile and Eclipse &
friends would not see it's "source code". (It can be enabled in the release
profile which could also override dependency version to match)

(This kind of backwards dependency is generally discouraged, but needed as
there is just a single Jena git repository and corresponding releases)

Btw, you don't need the legacy mvn eclipse:eclipse as you are using the
recommended "Import existing Maven project" in Eclipse, which is happy
enough with the pom.xml files (except as we see for jena-shaded-guava)


On 11 Sep 2017 7:40 pm, <aj...@apache.org> wrote:

This is a long-standing annoyance caused by our need to shade a modern
version of Guava into the code to avoid conflicting with the very old
version in Hadoop.

Do you have the jena0-shaded-guava project open in Eclipse? The problem
usually goes away if it is closed.


ajs6f
Chris Tomlinson wrote on 9/11/17 1:47 PM:

Hi,
>
> I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up
> properly with imports like:
>
> import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
>> import org.apache.jena.ext.com.google.common.cache.CacheStats ;
>>
>
> I "git clone" jena and
>
>     mvn clean install
>     mvn eclipse:eclipse
>
> and then import the various submodules as existing maven projects into
> eclipse. Once the imports complete there are a few of the submodules with
> syntax errors in eclipse centered on the shaded guava. The projects with
> errors all have
>
>     jena-shaded-guava
>
> as a project dependency in the .project and also a library reference to
> M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.
>
> The jena repo and submodules build and test fine from the command line.
>
> I’ve run maven update project on all of the jena projects and once the
> “update project” process completes the errors are cleared (a result of
> “clean projects” being checked) from all of the projects and then during
> the “building workspace” process the errors reappear one-by-one as the
> workspace is rebuilt.
>
> I appreciate any ideas about what I’m stumbling on.
>
> Thanks,
> Chris
>
>
>

Re: eclipse and shaded guava?

Posted by aj...@apache.org.
This is a long-standing annoyance caused by our need to shade a modern version of Guava into the code to avoid conflicting with the very old version in Hadoop.

Do you have the jena0-shaded-guava project open in Eclipse? The problem usually goes away if it is closed.


ajs6f
Chris Tomlinson wrote on 9/11/17 1:47 PM:
> Hi,
>
> I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up properly with imports like:
>
>> import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
>> import org.apache.jena.ext.com.google.common.cache.CacheStats ;
>
> I "git clone" jena and
>
>     mvn clean install
>     mvn eclipse:eclipse
>
> and then import the various submodules as existing maven projects into eclipse. Once the imports complete there are a few of the submodules with syntax errors in eclipse centered on the shaded guava. The projects with errors all have
>
>     jena-shaded-guava
>
> as a project dependency in the .project and also a library reference to M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.
>
> The jena repo and submodules build and test fine from the command line.
>
> I’ve run maven update project on all of the jena projects and once the “update project” process completes the errors are cleared (a result of “clean projects” being checked) from all of the projects and then during the “building workspace” process the errors reappear one-by-one as the workspace is rebuilt.
>
> I appreciate any ideas about what I’m stumbling on.
>
> Thanks,
> Chris
>
>

Re: eclipse and shaded guava?

Posted by "Bruno P. Kinoshita" <br...@yahoo.com.br.INVALID>.
At work I accidentally installed Eclipse JEE (I prefer using the Java version). It came with support for JS, HTML, XML, etc, and validation turned on by default.
What I did, was to open Window / Preferences, search for Validation. Then disabled everything under General/Validation and XML/**/Validation.
On the General/Validation, I also unchecked "Allow projects to override these preference settings", and checked to Suspend all validators.
Deleted the projects/working sets, restarted Eclipse, imported again, and didn't get the annoying validation messages in the beans/web.xml/etc XML files.
Hope that helpsBruno


      From: Chris Tomlinson <ch...@gmail.com>
 To: "brunodepaulak@yahoo.com.br" <br...@yahoo.com.br> 
Cc: "dev@jena.apache.org" <de...@jena.apache.org>
 Sent: Tuesday, 12 September 2017 8:51 AM
 Subject: Re: eclipse and shaded guava?
   
Hi Bruno, ajs6f, and Stian,
All most helpful. Following the writeup on "Using Jena with Eclipse", the key that I was missing was:
   closing the jena-shaded-guava project 
before running the maven project update.
It is good to know that the mvn eclipse:eclipse is not needed.
The remaining oddity at this point is a “Validating jena-core” process that seems to run very slowly around 73%:
  /jena-core/testing/ontology/dig/owl/basicq/test_12.query.xml  /jena-core/testing/ontology/dig/owl/basicq/test_13.query.xml  /jena-core/testing/ontology/dig/owl/basicq/test_14.query.xml  . . .
and so on. I imagine there’s a way to inhibit running the validation initially. I’ve been cancelling the process and the workspace goes through another rebuild and the workspace seems mostly fine except that the Validating jena-core starts up again and there’s an error on the pom.xml in jena-fuseki.war:
    web.xml is missing and <failOnMissingWebXml> is set to true pom.xml /jena-fuseki-war line 76 Maven Java EE Configuration Problem
which seems odd since the path in the pom.xml:
    <webXml>../jena-fuseki-core/src/main/webapp/WEB-INF/web.xml</webXml>
looks fine.
The second time that the “Validating jena-core” is cancelled it seems to stay stopped.
Thanks,Chris


On Sep 11, 2017, at 2:59 PM, Bruno P. Kinoshita <br...@yahoo.com.br> wrote:
Hi Chris,
I used to forget how to fix this issue, so updated the docs for using Eclipse to dev Jena.
https://jena.apache.org/tutorials/using_jena_with_eclipse.html
Give it a try and let us know if we need to update the docs.
CheersBruno

Sent from Yahoo Mail on Android 
 
  On Tue, 12 Sep 2017 at 5:47, Chris Tomlinson<ch...@gmail.com> wrote:   Hi,

I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up properly with imports like:

> import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
> import org.apache.jena.ext.com.google.common.cache.CacheStats ;

I "git clone" jena and

    mvn clean install
    mvn eclipse:eclipse

and then import the various submodules as existing maven projects into eclipse. Once the imports complete there are a few of the submodules with syntax errors in eclipse centered on the shaded guava. The projects with errors all have

    jena-shaded-guava

as a project dependency in the .project and also a library reference to M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.

The jena repo and submodules build and test fine from the command line.

I’ve run maven update project on all of the jena projects and once the “update project” process completes the errors are cleared (a result of “clean projects” being checked) from all of the projects and then during the “building workspace” process the errors reappear one-by-one as the workspace is rebuilt.

I appreciate any ideas about what I’m stumbling on.

Thanks,
Chris

  




   

Re: eclipse and shaded guava?

Posted by Chris Tomlinson <ch...@gmail.com>.
Hi Bruno, ajs6f, and Stian,

All most helpful. Following the writeup on "Using Jena with Eclipse", the key that I was missing was:

   closing the jena-shaded-guava project 

before running the maven project update.

It is good to know that the mvn eclipse:eclipse is not needed.

The remaining oddity at this point is a “Validating jena-core” process that seems to run very slowly around 73%:

  /jena-core/testing/ontology/dig/owl/basicq/test_12.query.xml
  /jena-core/testing/ontology/dig/owl/basicq/test_13.query.xml
  /jena-core/testing/ontology/dig/owl/basicq/test_14.query.xml
  . . .

and so on. I imagine there’s a way to inhibit running the validation initially. I’ve been cancelling the process and the workspace goes through another rebuild and the workspace seems mostly fine except that the Validating jena-core starts up again and there’s an error on the pom.xml in jena-fuseki.war:

    web.xml is missing and <failOnMissingWebXml> is set to true	pom.xml	/jena-fuseki-war	line 76	Maven Java EE Configuration Problem

which seems odd since the path in the pom.xml:

    <webXml>../jena-fuseki-core/src/main/webapp/WEB-INF/web.xml</webXml>

looks fine.

The second time that the “Validating jena-core” is cancelled it seems to stay stopped.

Thanks,
Chris


> On Sep 11, 2017, at 2:59 PM, Bruno P. Kinoshita <br...@yahoo.com.br> wrote:
> 
> Hi Chris,
> 
> I used to forget how to fix this issue, so updated the docs for using Eclipse to dev Jena.
> 
> https://jena.apache.org/tutorials/using_jena_with_eclipse.html <https://jena.apache.org/tutorials/using_jena_with_eclipse.html>
> 
> Give it a try and let us know if we need to update the docs.
> 
> Cheers
> Bruno
> 
> Sent from Yahoo Mail on Android <https://overview.mail.yahoo.com/mobile/?.src=Android>
> On Tue, 12 Sep 2017 at 5:47, Chris Tomlinson
> <ch...@gmail.com> wrote:
> Hi,
> 
> I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up properly with imports like:
> 
> > import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
> > import org.apache.jena.ext.com.google.common.cache.CacheStats ;
> 
> I "git clone" jena and
> 
>     mvn clean install
>     mvn eclipse:eclipse
> 
> and then import the various submodules as existing maven projects into eclipse. Once the imports complete there are a few of the submodules with syntax errors in eclipse centered on the shaded guava. The projects with errors all have
> 
>     jena-shaded-guava
> 
> as a project dependency in the .project and also a library reference to M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.
> 
> The jena repo and submodules build and test fine from the command line.
> 
> I’ve run maven update project on all of the jena projects and once the “update project” process completes the errors are cleared (a result of “clean projects” being checked) from all of the projects and then during the “building workspace” process the errors reappear one-by-one as the workspace is rebuilt.
> 
> I appreciate any ideas about what I’m stumbling on.
> 
> Thanks,
> Chris
> 


Re: eclipse and shaded guava?

Posted by "Bruno P. Kinoshita" <br...@yahoo.com.br.INVALID>.
Hi Chris,
I used to forget how to fix this issue, so updated the docs for using Eclipse to dev Jena.
https://jena.apache.org/tutorials/using_jena_with_eclipse.html
Give it a try and let us know if we need to update the docs.
CheersBruno

Sent from Yahoo Mail on Android 
 
  On Tue, 12 Sep 2017 at 5:47, Chris Tomlinson<ch...@gmail.com> wrote:   Hi,

I’m having a bit of a hassle getting eclipse Mars 4.5.2 to hook up properly with imports like:

> import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
> import org.apache.jena.ext.com.google.common.cache.CacheStats ;

I "git clone" jena and

    mvn clean install
    mvn eclipse:eclipse

and then import the various submodules as existing maven projects into eclipse. Once the imports complete there are a few of the submodules with syntax errors in eclipse centered on the shaded guava. The projects with errors all have

    jena-shaded-guava

as a project dependency in the .project and also a library reference to M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar in the .classpath.

The jena repo and submodules build and test fine from the command line.

I’ve run maven update project on all of the jena projects and once the “update project” process completes the errors are cleared (a result of “clean projects” being checked) from all of the projects and then during the “building workspace” process the errors reappear one-by-one as the workspace is rebuilt.

I appreciate any ideas about what I’m stumbling on.

Thanks,
Chris