كيف يمكنني تصدير المكتبات التابعة إلى دليل للنشر في Gradle؟

StackOverflow https://stackoverflow.com/questions/3872377

  •  28-09-2019
  •  | 
  •  

سؤال

أحتاج إلى نشر الكود الخاص بي على جهاز آخر. كيف أقوم بتصدير الجرار التابعة إلى دليل LIB؟

هل كانت مفيدة؟

المحلول

لست متأكدًا مما إذا كانت هذه هي الطريقة الصحيحة ، ولكن لنسخ الجرار إلى دليل lib أقوم بما يلي:

/**
 * Copies the dependencies to the lib directory in preparation for them to be added to a jar file
 */
 task copyRuntimeDependencies(dependsOn: configurations.runtime.buildArtifacts, type: Copy) 
  {
    into('build/output/lib')
    from configurations.runtime
    from configurations.runtime.allArtifacts*.file
  }

نصائح أخرى

هذه هي الطريقة للقيام بذلك مع Gradle 2.x:

task copyToLib(type: Copy) {
    // into "build/lib"
    into "lib"
    from configurations.classpath
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top