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

15 comments
Comment actions Permalink

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

0
Comment actions Permalink

Just creating a jar which contains the selected classes and a generated manifest file

0
Comment actions Permalink

No such action is provided out of the box. The whole topic of producing artifacts from IntelliJ IDEA is covered here.

Denis

0
Comment actions Permalink

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.

Just creating a jar which contains the selected classes and a generated manifest file

>

---
Original message URL: http://devnet.jetbrains.net/message/5308417#5308417



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Hi, Tex. I reported similar issue IDEA-68200 - binary patches from changesets. Could you please describe, why do you need it?

thanks, Alex

0
Comment actions Permalink

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?

0
Comment actions Permalink

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.

1
Comment actions Permalink

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?

0
Comment actions Permalink

You can ask veracode support for the recommended way to handle limited set of classes in a project.

0
Comment actions Permalink

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?

0
Comment actions Permalink

You can find the documentation for the specific use cases like this https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html .

0
Comment actions Permalink

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!

0
Comment actions Permalink

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:

1
Comment actions Permalink

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

0
Comment actions Permalink

Feel  free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.

0

Please sign in to leave a comment.