Recommended way to define non-Android package

33 views
Skip to first unread message

Michael Wallstedt

unread,
Aug 26, 2014, 6:24:06 PM8/26/14
to adt...@googlegroups.com
What is the recommended way to define a module containing plain Java code that I want to include in my project? I assume this needs to be done at the gradle level, since changes that only manipulates .iml files will be lost on a "gradle sync". If I use the android gradle plugin, am I required to provide some sort of dummy manifest?

Siva Velusamy

unread,
Aug 26, 2014, 6:46:43 PM8/26/14
to adt...@googlegroups.com
Not sure if I'm missing something, but this is as simple as:

settings.gradle: include 'java-module'
java-module/build.gradle: apply plugin: 'java'

i.e. just follow gradle's approach to adding a new module and apply java plugin on that module.

Your trouble begins if you now go on and say you want Roboelectric, but that has been rehashed many times :)


On Tue, Aug 26, 2014 at 3:24 PM, Michael Wallstedt <mikewa...@google.com> wrote:
What is the recommended way to define a module containing plain Java code that I want to include in my project? I assume this needs to be done at the gradle level, since changes that only manipulates .iml files will be lost on a "gradle sync". If I use the android gradle plugin, am I required to provide some sort of dummy manifest?

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Barta

unread,
Aug 26, 2014, 6:46:43 PM8/26/14
to adt...@googlegroups.com
The New Module wizard has an option for a "Java library" that creates a plain Java library without Android stuff; it uses the normal Java plugin in its build.gradle file. You can also do the same steps by hand that the wizard does for you, setting up a Gradle build file that uses the Java plugin and referencing it in your settings.gradle file. Other modules can depend on the Java module as per usual.



On Tue, Aug 26, 2014 at 3:24 PM, Michael Wallstedt <mikewa...@google.com> wrote:
What is the recommended way to define a module containing plain Java code that I want to include in my project? I assume this needs to be done at the gradle level, since changes that only manipulates .iml files will be lost on a "gradle sync". If I use the android gradle plugin, am I required to provide some sort of dummy manifest?

--

Michael Wallstedt

unread,
Aug 26, 2014, 7:32:31 PM8/26/14
to adt...@googlegroups.com
I see. I had assumed (incorrectly) that the java plugin was strictly for the gradle build logic, and that another plugin like com.android.library or idea would be necessary to define an IntelliJ module. Thanks!


--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/iFSNnrENxCw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages