का उपयोग करके फ्लाई पर jaxb.index फ़ाइल कैसे बनाएं, यह एक प्रश्न पूछने के बजाय ज्ञान साझा करने का अधिक है। सोचा कि इस छोटे चींटी स्निपेट किसी के लिए उपयोगी हो सकता है।एंट (या मेवेन)
<target name="create-jaxb-index" depends="compile">
<!-- Create a suitable jaxb.index file on the fly to remove the need for an ObjectFactory
jaxb.index is a simple list of the domain objects without package or extension, e.g.
org.example.Domain.java -> Domain
-->
<fileset id="domain-sources" dir="${src}">
<include name="org/example/*.java"/>
</fileset>
<pathconvert property="domain-list" refid="domain-sources" pathsep="${line.separator}">
<chainedmapper>
<flattenmapper/>
<globmapper from="*.java" to="*" casesensitive="false"/>
</chainedmapper>
</pathconvert>
<echo file="${target}/classes/org/example/jaxb.index" message="${domain-list}"/>
</target>
ठीक है, ठीक है, तो यह पूरी तरह से जाना नहीं है और सभी पैकेज के नाम तक जमा इतना है कि यह उचित फ़ाइल संरचना को फिर से संगठित कर सकते हैं, लेकिन यह आप आरंभ करने के लिए काफी अच्छा है।
आशा है कि यह मदद करता है।
इसके अलावा, आप सिर्फ इस छोटे से टुकड़ा (कम लक्ष्य तत्व) एक Maven में सम्मिलित कर सकता है इस तरह का निर्माण:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<!-- Create a suitable jaxb.index file on the fly to remove the need for an ObjectFactory
jaxb.index is a simple list of the domain objects without package or extension, e.g.
org.example.Domain.java -> Domain
-->
<fileset id="domain-sources" dir="${build.sourceDirectory}">
<include name="org/example/domain/*.java"/>
</fileset>
<pathconvert property="domain-list" refid="domain-sources" pathsep="${line.separator}">
<chainedmapper>
<flattenmapper/>
<globmapper from="*.java" to="*" casesensitive="false"/>
</chainedmapper>
</pathconvert>
<echo file="${build.outputDirectory}/org/example/domain/jaxb.index" message="${domain-list}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
धन्यवाद, यह उपयोगी है! यदि आप ढांचे के इच्छित दायरे से एक बालों से बाहर निकलते हैं, तो आप क्विर्क और हैक के नरक में प्रवेश करते हैं। कभी-कभी मुझे लगता है कि मैं जावा, मेवेन, ग्रोवी इत्यादि के बारे में थक गया हूं – boumbh
@boumbh मदद करने के लिए खुशी हुई। वेब विकास की जबरदस्त जटिलता को कम करने का एक तरीका अन्य भाषाओं को आजमा देना है। –
अगर केवल मेरे पास ^^ था। मैं आजकल नट्स क्रैकिंग के लिए स्लेजहैमर का उपयोग करने की प्रवृत्ति को नोट करता हूं। जेएक्सबी एक बहुत ही कुशल स्लेजहैमर है, यह मेरे नट्स को बहुत अच्छी तरह से क्रैक करता है (नकारात्मक अर्थ के बिना), लेकिन कभी-कभी मुझे एक सरल उपकरण की आसान हैंडलिंग याद आती है। समस्याग्रस्त एक अन्य भाषा का उपयोग कर अलग-अलग होता। जरूरी नहीं है। जैसा कि कुछ कहते हैं: "एक बुरा कार्यकर्ता हमेशा अपने औजारों को दोषी ठहराता है। एक अच्छे कार्यकर्ता के पास सही उपकरण होते हैं।" अगर मैं अपने टूल्स का चयन नहीं कर सकता, तो यह मुझे एक खराब कार्यकर्ता बनाता है। – boumbh