forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-test-solr.xml
117 lines (95 loc) · 3.21 KB
/
build-test-solr.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?xml version="1.0"?>
<project basedir="." name="portal-test-solr" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<macrodef name="prepare-solr">
<sequential>
<copy overwrite="true" todir="${solr.dir}/server/solr/liferay/conf">
<fileset dir="${solr.dir}/server/solr/configsets/data_driven_schema_configs/conf">
<exclude name="solrconfig.xml" />
</fileset>
<fileset dir="modules/apps/portal-search-solr/portal-search-solr/src/main/resources/META-INF/resources">
<include name="schema.xml" />
<include name="solrconfig.xml" />
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="unzip-solr">
<sequential>
<delete dir="${solr.dir}" />
<if>
<not>
<available file="${app.server.parent.dir}/${solr.zip.name}" />
</not>
<then>
<get
dest="${app.server.parent.dir}/${solr.zip.name}"
src="${solr.zip.url}"
verbose="true"
/>
</then>
</if>
<unzip
dest="${app.server.parent.dir}"
src="${app.server.parent.dir}/${solr.zip.name}"
/>
</sequential>
</macrodef>
<target name="configure-solr-osgi-bundle-properties">
<echo file="${liferay.home}/osgi/configs/com.liferay.portal.search.solr.configuration.SolrConfiguration.cfg">readURL=http://localhost:8983/solr/liferay
writeURL=http://localhost:8983/solr/liferay</echo>
</target>
<target name="delete-elasticseach-osgi-bundle">
<delete failonerror="false">
<fileset
dir="${liferay.home}/osgi/portal"
includes="com.liferay.portal.search.elasticsearch*.jar"
/>
</delete>
</target>
<target name="start-solr">
<unzip-solr />
<prepare-solr />
<antcall target="delete-elasticseach-osgi-bundle" />
<gradle-execute dir="modules/apps/portal-search-solr/portal-search-solr" task="deploy">
<arg value="clean" />
</gradle-execute>
<antcall target="configure-solr-osgi-bundle-properties" />
<local name="solr.server.not.started" />
<if>
<os family="unix" />
<then>
<chmod file="${solr.dir}/bin/solr" perm="a+x" />
<exec dir="${solr.dir}/bin" executable="/bin/bash">
<arg value="-c" />
<arg value="./solr start -V" />
</exec>
<waitfor maxwait="10" maxwaitunit="second" timeoutproperty="solr.server.not.started">
<http url="http://localhost:8983/solr" />
</waitfor>
<fail if="solr.server.not.started" message="Solr server failed to initialize." />
<exec dir="${solr.dir}/bin" executable="/bin/bash">
<arg value="-c" />
<arg value="./solr create_core -c liferay -d ${solr.dir}/server/solr/liferay/conf" />
</exec>
</then>
<elseif>
<os family="windows" />
<then>
<exec dir="${solr.dir}/bin" executable="cmd" spawn="true">
<arg value="/c" />
<arg value="solr -V" />
</exec>
<waitfor maxwait="10" maxwaitunit="second" timeoutproperty="solr.server.not.started">
<http url="http://localhost:8983/solr" />
</waitfor>
<fail if="solr.server.not.started" message="Solr server failed to initialize." />
<exec dir="${solr.dir}/bin" executable="cmd" >
<arg value="/c" />
<arg value="solr create_core -c liferay -d ${solr.dir}/server/solr/liferay/conf" />
</exec>
</then>
</elseif>
</if>
</target>
</project>