export class to jar
Answered
Hi,
in Eclipse it was easily possible to right click on a class and export it to a jar file. Is something similar possible in Idea ?
thanks,
T
Please sign in to leave a comment.
Hello,
Sorry, we're not eclipse fellows, so, it's not clear what do you mean by 'exporting to jar'. Is it something like creating jar that contains only the *.class file for the target class or something else?
Denis
Just creating a jar which contains the selected classes and a generated manifest file
No such action is provided out of the box. The whole topic of producing artifacts from IntelliJ IDEA is covered here.
Denis
In IDEA you can use artifacts for that. Open 'Project Structure' dialog, select 'Artifacts' item and press '+'->'Jar'->'From module with
dependencies'. When artifact is created you can use Build | 'Build artifact' action to generate the jar.
>
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi, Tex. I reported similar issue IDEA-68200 - binary patches from changesets. Could you please describe, why do you need it?
thanks, Alex
How come intellij has no ease way to create a jar file from specific chosen classes? why do I have to create a .jar file from the whole project only?
Can anyone from intellij team help with that?
You can use Ant, Maven or Gradle to create customized jars with the limited set of classes. Normally one needs to package all the classes, so it's not a common use case to support.
This case is an specifically case where we need to run veracode to specific classes only, and not the whole project. Any steps on that?
You can ask veracode support for the recommended way to handle limited set of classes in a project.
You said: "You can use Ant, Maven or Gradle to create customized jars with the limited set of classes. "
I asked you if there are steps for doing what you said. So, is there any steps to do what you said from ant, maven, or gradle using intellij?
You can find the documentation for the specific use cases like this https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html .
This is a shame you keep me sending me to somewhere else. I am looking for the steps in intellij not on the Maven site!
If your project is not already using Maven and you don't have plans to convert it to Maven, it may be easier to customize the artifact as described here.
With this approach jar artifact can have only one .class file:
It could be useful, for example in relation to this issue https://github.com/spring-projects/spring-boot/issues/14622 to easily create a jar with a subset of classes
Feel free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.