2012-09-24 17 views
18

मैं एक ग्रैडल प्लगइन लिख रहा हूं और प्लगइन का उपयोग करने वाली ग्रैडल स्क्रिप्ट में काम करने के लिए apply plugin: कमांड प्राप्त करने में विफल रहा हूं। मैं Gradle 1.1 का उपयोग कर रहा हूँ।कस्टम ग्रैडल प्लगइन आईडी नहीं मिली

मैंने clean build के साथ प्लगइन बनाया है और मैं अब इसे एक फ्लैट रेपो के माध्यम से ग्रैडल बिल्ड में जोड़ने का प्रयास कर रहा हूं। ऐसा लगता है कि काम कर रहा है लेकिन ग्रैडल यह नहीं उठा रहा है कि ID test-plugin आईडी के साथ एक प्लगइन है। प्लगइन के settings.gradle में प्रोजेक्ट का नाम test-plugin है और META-INF/gradle-plugins में गुण फ़ाइल test-plugin.properties भी है। मुझे यकीन नहीं है कि मैं प्लगइन आईडी कहां निर्दिष्ट कर सकता हूं।

कि test-plugin उपयोग कर रहा है परियोजना में gradle.build फ़ाइल: Gradle से

repositories { 
    flatDir name: 'libs', dirs: "../build/libs" 
} 

dependencies { 
    compile 'test:test-plugin:0.1' 
} 

apply plugin: 'test-plugin' 

त्रुटि:

What went wrong: 
A problem occurred evaluating root project 'tmp'. 
Plugin with id 'test-plugin' not found. 

उत्तर

17

प्लगइन जार एक निर्माण स्क्रिप्ट निर्भरता के रूप में जोड़ा जाना आवश्यक है:

buildscript { 
    repositories { flatDir name: 'libs', dirs: "../build/libs" } 
    dependencies { classpath 'test:test-plugin:0.1' } 
} 

apply plugin: "test-plugin" 
+0

त्वरित उत्तर के लिए धन्यवाद! –

+0

आप एकाधिक प्लगइन कैसे जोड़ते हैं? –