You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Aleksander Akerø <so...@gmail.com> on 2012/03/28 13:39:46 UTC

Build solr with Maven

Hi

 

My company has just decided to use maven to build new projects, which then
includes building solr with maven too.

But then it has been decided that solr_home also should be installed within
the webapp someplace. But now I have got the problem that solr can’t find
the config files and so on. I have come across some posts here and there
which says that solr_home should not be placed within the webapp.

Is that correct? If so, what are the reasons for it, and should it not work
at all?

 

Aleksander Akerø


RE: Build solr with Maven

Posted by Aleksander Akerø <so...@gmail.com>.
Yes I figured my problem would be something like that. I'll try with the
catalina/tomcat home variables I think.
Thank you.

-----Original Message-----
From: Ingar Hov [mailto:ingar.hov@gmail.com] 
Sent: 29. mars 2012 14:13
To: solr-user@lucene.apache.org
Subject: Re: Build solr with Maven

I think you need absolute path. But perhaps if $CATALINA_HOME or
$TOMCAT_HOME is set, you can use it with your path.Haven't tried it though..

In any case, you should quite easily be able to verify if relative paths can
be used. All you need to do is to get the work directory for the webapp and
reflect that with your variable. In any case I don't think you can use a
path relative to web.xml. I believe the work directory is somewhere else
than /WEB-INF/ and that is the dir you need to make your variable relative
to..


On Thu, Mar 29, 2012 at 1:28 PM, Aleksander Akerø <so...@gmail.com>
wrote:
> Tried that, but I guess I am doing it wrong somehow with the paths.
>
> The home folder should be WEB-INF/solr inside the tomcat. But how 
> would I set that path correctly? Do I need to use absolute paths?
>
> -----Original Message-----
> From: Ingar Hov [mailto:ingar.hov@gmail.com]
> Sent: 29. mars 2012 12:57
> To: solr-user@lucene.apache.org
> Subject: Re: Build solr with Maven
>
> I see..
>
> Try to use <env-entry>...</env-entry> in web.xml.
>
> Regards,
> Ingar
>
> On Thu, Mar 29, 2012 at 8:34 AM, Aleksander Akerø 
> <so...@gmail.com>
> wrote:
>> Well, it's got all to do with how we have decided the rest of our 
>> deployment environment. So the point is basicly that there should be 
>> no configurations to the tomcat because the webapp should know all 
>> it's settings and could basicly be deployed to whatever tomcat 
>> without configuration. Also there should be no configuration done 
>> outside the
> webapp.
>>
>> That is basicly the rule that I have to live by, and I'm very 
>> thankful for your solution here but a tomcat configuration is out of the
question.
>> I was hoping there was some way to set this via mavens pom.xml or 
>> something like that.
>>
>> -----Original Message-----
>> From: Ingar Hov [mailto:ingar.hov@gmail.com]
>> Sent: 28. mars 2012 18:48
>> To: solr-user@lucene.apache.org
>> Subject: Re: Build solr with Maven
>>
>> Is there any good reason for keeping solr_home within the webapp?
>>
>> It should work, but I would not recommend it. Have you configured 
>> solr_home somewhere?
>> One way in Tomcat is to do something like this:
>>
>> --
>> <Context...>
>>  <Environment name="solr/home" type="java.lang.String"
>> value="[your_solr_home]" override="true"/> </Context>
>> --
>>
>> in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in 
>> $tomcat_home/conf/server xml.
>>
>> A better solution would probably be a maven project, but with two
modules.
>> This way you could build the modules together or individually. Then 
>> you can make adjustments to the config and reload core's at will, a 
>> feature you would lose with keeping solr_home within the webapp.
>>
>> Regards,
>> Ingar
>>
>>
>> On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø 
>> <so...@gmail.com>
>> wrote:
>>> Hi
>>>
>>>
>>>
>>> My company has just decided to use maven to build new projects, 
>>> which then includes building solr with maven too.
>>>
>>> But then it has been decided that solr_home also should be installed 
>>> within the webapp someplace. But now I have got the problem that 
>>> solr can’t find the config files and so on. I have come across some 
>>> posts here and there which says that solr_home should not be placed 
>>> within the
>> webapp.
>>>
>>> Is that correct? If so, what are the reasons for it, and should it 
>>> not work at all?
>>>
>>>
>>>
>>> Aleksander Akerø
>>>
>>
>


Re: Build solr with Maven

Posted by Ingar Hov <in...@gmail.com>.
I think you need absolute path. But perhaps if $CATALINA_HOME or
$TOMCAT_HOME is set, you can use it with your path.Haven't tried it
though..

In any case, you should quite easily be able to verify if relative
paths can be used. All you need to do is to get the work directory for
the webapp and reflect that with your variable. In any case I don't
think you can use a path relative to web.xml. I believe the work
directory is somewhere else than /WEB-INF/ and that is the dir you
need to make your variable relative to..


On Thu, Mar 29, 2012 at 1:28 PM, Aleksander Akerø
<so...@gmail.com> wrote:
> Tried that, but I guess I am doing it wrong somehow with the paths.
>
> The home folder should be WEB-INF/solr inside the tomcat. But how would I
> set that path correctly? Do I need to use absolute paths?
>
> -----Original Message-----
> From: Ingar Hov [mailto:ingar.hov@gmail.com]
> Sent: 29. mars 2012 12:57
> To: solr-user@lucene.apache.org
> Subject: Re: Build solr with Maven
>
> I see..
>
> Try to use <env-entry>...</env-entry> in web.xml.
>
> Regards,
> Ingar
>
> On Thu, Mar 29, 2012 at 8:34 AM, Aleksander Akerø <so...@gmail.com>
> wrote:
>> Well, it's got all to do with how we have decided the rest of our
>> deployment environment. So the point is basicly that there should be
>> no configurations to the tomcat because the webapp should know all
>> it's settings and could basicly be deployed to whatever tomcat without
>> configuration. Also there should be no configuration done outside the
> webapp.
>>
>> That is basicly the rule that I have to live by, and I'm very thankful
>> for your solution here but a tomcat configuration is out of the question.
>> I was hoping there was some way to set this via mavens pom.xml or
>> something like that.
>>
>> -----Original Message-----
>> From: Ingar Hov [mailto:ingar.hov@gmail.com]
>> Sent: 28. mars 2012 18:48
>> To: solr-user@lucene.apache.org
>> Subject: Re: Build solr with Maven
>>
>> Is there any good reason for keeping solr_home within the webapp?
>>
>> It should work, but I would not recommend it. Have you configured
>> solr_home somewhere?
>> One way in Tomcat is to do something like this:
>>
>> --
>> <Context...>
>>  <Environment name="solr/home" type="java.lang.String"
>> value="[your_solr_home]" override="true"/> </Context>
>> --
>>
>> in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in
>> $tomcat_home/conf/server xml.
>>
>> A better solution would probably be a maven project, but with two modules.
>> This way you could build the modules together or individually. Then
>> you can make adjustments to the config and reload core's at will, a
>> feature you would lose with keeping solr_home within the webapp.
>>
>> Regards,
>> Ingar
>>
>>
>> On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø
>> <so...@gmail.com>
>> wrote:
>>> Hi
>>>
>>>
>>>
>>> My company has just decided to use maven to build new projects, which
>>> then includes building solr with maven too.
>>>
>>> But then it has been decided that solr_home also should be installed
>>> within the webapp someplace. But now I have got the problem that solr
>>> can’t find the config files and so on. I have come across some posts
>>> here and there which says that solr_home should not be placed within
>>> the
>> webapp.
>>>
>>> Is that correct? If so, what are the reasons for it, and should it
>>> not work at all?
>>>
>>>
>>>
>>> Aleksander Akerø
>>>
>>
>

RE: Build solr with Maven

Posted by Aleksander Akerø <so...@gmail.com>.
Tried that, but I guess I am doing it wrong somehow with the paths.

The home folder should be WEB-INF/solr inside the tomcat. But how would I
set that path correctly? Do I need to use absolute paths?

-----Original Message-----
From: Ingar Hov [mailto:ingar.hov@gmail.com] 
Sent: 29. mars 2012 12:57
To: solr-user@lucene.apache.org
Subject: Re: Build solr with Maven

I see..

Try to use <env-entry>...</env-entry> in web.xml.

Regards,
Ingar

On Thu, Mar 29, 2012 at 8:34 AM, Aleksander Akerø <so...@gmail.com>
wrote:
> Well, it's got all to do with how we have decided the rest of our 
> deployment environment. So the point is basicly that there should be 
> no configurations to the tomcat because the webapp should know all 
> it's settings and could basicly be deployed to whatever tomcat without 
> configuration. Also there should be no configuration done outside the
webapp.
>
> That is basicly the rule that I have to live by, and I'm very thankful 
> for your solution here but a tomcat configuration is out of the question.
> I was hoping there was some way to set this via mavens pom.xml or 
> something like that.
>
> -----Original Message-----
> From: Ingar Hov [mailto:ingar.hov@gmail.com]
> Sent: 28. mars 2012 18:48
> To: solr-user@lucene.apache.org
> Subject: Re: Build solr with Maven
>
> Is there any good reason for keeping solr_home within the webapp?
>
> It should work, but I would not recommend it. Have you configured 
> solr_home somewhere?
> One way in Tomcat is to do something like this:
>
> --
> <Context...>
>  <Environment name="solr/home" type="java.lang.String"
> value="[your_solr_home]" override="true"/> </Context>
> --
>
> in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in 
> $tomcat_home/conf/server xml.
>
> A better solution would probably be a maven project, but with two modules.
> This way you could build the modules together or individually. Then 
> you can make adjustments to the config and reload core's at will, a 
> feature you would lose with keeping solr_home within the webapp.
>
> Regards,
> Ingar
>
>
> On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø 
> <so...@gmail.com>
> wrote:
>> Hi
>>
>>
>>
>> My company has just decided to use maven to build new projects, which 
>> then includes building solr with maven too.
>>
>> But then it has been decided that solr_home also should be installed 
>> within the webapp someplace. But now I have got the problem that solr 
>> can’t find the config files and so on. I have come across some posts 
>> here and there which says that solr_home should not be placed within 
>> the
> webapp.
>>
>> Is that correct? If so, what are the reasons for it, and should it 
>> not work at all?
>>
>>
>>
>> Aleksander Akerø
>>
>


Re: Build solr with Maven

Posted by Ingar Hov <in...@gmail.com>.
I see..

Try to use <env-entry>...</env-entry> in web.xml.

Regards,
Ingar

On Thu, Mar 29, 2012 at 8:34 AM, Aleksander Akerø
<so...@gmail.com> wrote:
> Well, it's got all to do with how we have decided the rest of our deployment
> environment. So the point is basicly that there should be no configurations
> to the tomcat because the webapp should know all it's settings and could
> basicly be deployed to whatever tomcat without configuration. Also there
> should be no configuration done outside the webapp.
>
> That is basicly the rule that I have to live by, and I'm very thankful for
> your solution here but a tomcat configuration is out of the question.
> I was hoping there was some way to set this via mavens pom.xml or something
> like that.
>
> -----Original Message-----
> From: Ingar Hov [mailto:ingar.hov@gmail.com]
> Sent: 28. mars 2012 18:48
> To: solr-user@lucene.apache.org
> Subject: Re: Build solr with Maven
>
> Is there any good reason for keeping solr_home within the webapp?
>
> It should work, but I would not recommend it. Have you configured solr_home
> somewhere?
> One way in Tomcat is to do something like this:
>
> --
> <Context...>
>  <Environment name="solr/home" type="java.lang.String"
> value="[your_solr_home]" override="true"/> </Context>
> --
>
> in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in
> $tomcat_home/conf/server xml.
>
> A better solution would probably be a maven project, but with two modules.
> This way you could build the modules together or individually. Then you can
> make adjustments to the config and reload core's at will, a feature you
> would lose with keeping solr_home within the webapp.
>
> Regards,
> Ingar
>
>
> On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø <so...@gmail.com>
> wrote:
>> Hi
>>
>>
>>
>> My company has just decided to use maven to build new projects, which
>> then includes building solr with maven too.
>>
>> But then it has been decided that solr_home also should be installed
>> within the webapp someplace. But now I have got the problem that solr
>> can’t find the config files and so on. I have come across some posts
>> here and there which says that solr_home should not be placed within the
> webapp.
>>
>> Is that correct? If so, what are the reasons for it, and should it not
>> work at all?
>>
>>
>>
>> Aleksander Akerø
>>
>

RE: Build solr with Maven

Posted by Aleksander Akerø <so...@gmail.com>.
Well, it's got all to do with how we have decided the rest of our deployment
environment. So the point is basicly that there should be no configurations
to the tomcat because the webapp should know all it's settings and could
basicly be deployed to whatever tomcat without configuration. Also there
should be no configuration done outside the webapp.

That is basicly the rule that I have to live by, and I'm very thankful for
your solution here but a tomcat configuration is out of the question.
I was hoping there was some way to set this via mavens pom.xml or something
like that.

-----Original Message-----
From: Ingar Hov [mailto:ingar.hov@gmail.com] 
Sent: 28. mars 2012 18:48
To: solr-user@lucene.apache.org
Subject: Re: Build solr with Maven

Is there any good reason for keeping solr_home within the webapp?

It should work, but I would not recommend it. Have you configured solr_home
somewhere?
One way in Tomcat is to do something like this:

--
<Context...>
  <Environment name="solr/home" type="java.lang.String"
value="[your_solr_home]" override="true"/> </Context>
--

in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in
$tomcat_home/conf/server xml.

A better solution would probably be a maven project, but with two modules.
This way you could build the modules together or individually. Then you can
make adjustments to the config and reload core's at will, a feature you
would lose with keeping solr_home within the webapp.

Regards,
Ingar


On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø <so...@gmail.com>
wrote:
> Hi
>
>
>
> My company has just decided to use maven to build new projects, which 
> then includes building solr with maven too.
>
> But then it has been decided that solr_home also should be installed 
> within the webapp someplace. But now I have got the problem that solr 
> can’t find the config files and so on. I have come across some posts 
> here and there which says that solr_home should not be placed within the
webapp.
>
> Is that correct? If so, what are the reasons for it, and should it not 
> work at all?
>
>
>
> Aleksander Akerø
>


Re: Build solr with Maven

Posted by Ingar Hov <in...@gmail.com>.
Is there any good reason for keeping solr_home within the webapp?

It should work, but I would not recommend it. Have you configured
solr_home somewhere?
One way in Tomcat is to do something like this:

--
<Context...>
  <Environment name="solr/home" type="java.lang.String"
value="[your_solr_home]" override="true"/>
</Context>
--

in either: $tomcat_home/conf/Catalina/localhost/solr.xml or in
$tomcat_home/conf/server xml.

A better solution would probably be a maven project, but with two
modules. This way you could build the modules together or
individually. Then you can make adjustments to the config and reload
core's at will, a feature you would lose with keeping solr_home within
the webapp.

Regards,
Ingar


On Wed, Mar 28, 2012 at 1:39 PM, Aleksander Akerø
<so...@gmail.com> wrote:
> Hi
>
>
>
> My company has just decided to use maven to build new projects, which then
> includes building solr with maven too.
>
> But then it has been decided that solr_home also should be installed within
> the webapp someplace. But now I have got the problem that solr can’t find
> the config files and so on. I have come across some posts here and there
> which says that solr_home should not be placed within the webapp.
>
> Is that correct? If so, what are the reasons for it, and should it not work
> at all?
>
>
>
> Aleksander Akerø
>