Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide integration with ant or standalone jar #337

Open
petromir opened this issue Nov 20, 2014 · 38 comments
Open

Provide integration with ant or standalone jar #337

petromir opened this issue Nov 20, 2014 · 38 comments

Comments

@petromir
Copy link

It would be great if Qulice can be integrated with ant or run as a standalone jar.

@davvd
Copy link

davvd commented Nov 24, 2014

we'll find someone to do this task, soon

@davvd
Copy link

davvd commented Nov 24, 2014

@yegor256 the task is yours (budget is 30 mins)

@davvd
Copy link

davvd commented Dec 15, 2014

@yegor256 this task is not yours any more (took too long), please stop. I'll give you something else

@davvd davvd removed the @yegor256 label Dec 15, 2014
@davvd
Copy link

davvd commented Dec 31, 2014

@alevohin it's yours now, please proceed keeping in mind our principles. Feel free to ask any technical questions right here in the ticket

The budget here is 30 mins, which is exactly how much time will be paid for, when the task is completed

alevohin pushed a commit to alevohin/qulice that referenced this issue Jan 3, 2015
@alevohin
Copy link

@davvd PR #361 is waiting for reviewer for 10 days

@davvd
Copy link

davvd commented Jan 22, 2015

@alevohin this task is not yours any more (took too long), please stop. I'll give you something else

-60 to your rating, your total score is +270

@alevohin
Copy link

@davvd @yegor256 this taks is almost completed (PR merged and released). I think after deploy phase it will be finished. BTW PR was waiting for 15 days for code reviewer.

@davvd
Copy link

davvd commented Jan 22, 2015

there is a puzzle in this code 337-3d7cb361, we'll resolve it later

@yegor256
Copy link
Owner

@davvd assign @alevohin back to this issue pls

@alevohin
Copy link

@petromir this feature was released, tag is 0.12.1.
Usage is described here: http://www.qulice.com/qulice-ant/index.html
Please check and close.

@davvd
Copy link

davvd commented Jan 23, 2015

@davvd assign @alevohin back to this issue pls

@yegor256 OK @alevohin please proceed, this task is yours

@alevohin
Copy link

@petromir this feature was released, tag is 0.12.1.
Usage is described here: http://www.qulice.com/qulice-ant/index.html
Please check and close.

@petromir
Copy link
Author

@yegor256, @davvd and @alevohin - I plan to test it this week. I'll close the issue asap.

@alevohin
Copy link

alevohin commented Feb 1, 2015

@petromir have you tested it? I suggest it's better to close this issue and open a new one if you'll find bugs/remarks.

@petromir
Copy link
Author

petromir commented Feb 1, 2015

Hi. Please provide a procedure for building quilice-ant-jar with required dependencies or change the example on http://www.qulice.com/qulice-ant/index.html to include them when defining the custom task:

<taskdef name="qulice"
              classname="com.qulice.ant.QuliceTask"
              classpath="${com.qulice:qulice-ant:jar}; dependencies..."/>

@alevohin
Copy link

alevohin commented Feb 1, 2015

@petromir I think it's better to use something like http://ant.apache.org/ivy/ for dependency management. If you think example is wrong please provide another issue.

@petromir
Copy link
Author

petromir commented Feb 1, 2015

@alevohin This is what I did using your example:
The build.xml:

<project name="Qulice" basedir="." default="qulice">
    <taskdef name="qulice"
             classname="com.qulice.ant.QuliceTask"
             classpath="${basedir}/lib/qulice-ant-1.0-SNAPSHOT.jar"/>
    <target name="qulice" description="Execute qulice checks">
        <property name="license" value="LICENSE.txt"/>
        <qulice srcdir="${basedir}/src/main/java" classesdir="${basedir}/out/production"
                classpath="${basedir}/out/production:${basedir}"/>
    </target>
</project>

and the result is:

BUILD FAILED
D:\DEV\Projects\qulice-ant-test\build.xml:4: taskdef A class needed by class com.qulice.ant.QuliceTask cannot be found: com/qulice/spi/ValidationException
 using the classloader AntClassLoader[D:\DEV\Projects\qulice-ant-test\lib\qulice-ant-1.0-SNAPSHOT.jar]

So what else should I put in classpath attribute to satisfy all required dependencies?

@alevohin
Copy link

alevohin commented Feb 2, 2015

@petromir if you don't use any dependency management with ant, the simplest way may be:

  1. install maven (or use vm with maven)
  2. create file pom.xml like this
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <groupId>test</groupId>
       <artifactId>test</artifactId>
       <version>1.0-SNAPSHOT</version>
       <packaging>jar</packaging>
       <dependencies>
<dependency>
    <groupId>com.qulice</groupId>
    <artifactId>qulice-ant</artifactId>
    <version>0.12.1</version>
</dependency>
       </dependencies>
</project>
  1. execute from dir with created pom.xml command mvn dependency:tree to view dependency tree
  2. execute from dir with created pom.xml command mvn dependency:copy-dependencies to download all dependencies. You'll find all your dependencies in folder ./target/dependencies. Then you should try something like
<qulice srcdir="${basedir}/src/main/java" classesdir="${basedir}/out/production"
                classpath="${basedir}/out/production:${basedir}/target/dependencies"/>

@petromir
Copy link
Author

petromir commented Feb 4, 2015

@alevohin I had to change the build.xml to this:

<project name="Qulice" basedir="." default="qulice">
    <taskdef name="qulice"
             classname="com.qulice.ant.QuliceTask">
        <classpath>
            <fileset dir="lib">
                <include name="**/*.jar"/>
            </fileset>
        </classpath>
    </taskdef>
    <target name="qulice" description="Execute qulice checks">
        <property name="license" value="LICENSE.txt"/>
        <qulice srcdir="${basedir}/src/main/java" classesdir="${basedir}/out/production"
                classpath="${basedir}/lib/dependencies;${basedir}/out/production">
        </qulice>
    </target>
</project>

but now I'm getting the following exception, which I believe comes from wrong classpath attribute value of qulice task:

D:\DEV\Projects\qulice-ant-test\build.xml:13: java.lang.IllegalStateException: Failed to configure checker
        at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:88)
        at com.qulice.ant.QuliceTask.validate(QuliceTask.java:146)
        at com.qulice.ant.QuliceTask.execute(QuliceTask.java:102)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module JavadocPackage - Unable to instantiate JavadocPackage
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:179)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:184)
        at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:86)
        ... 19 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate JavadocPackage
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:155)
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:154)
        ... 21 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate JavadocPackageCheck
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:98)
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:152)
        ... 22 more

Unfortunately I couldn't find a workaround as I did for taskdef
Please note that I'm testing this on Windows and Java 8!

P.S. I can send you the test project if you like.

@alevohin
Copy link

alevohin commented Feb 6, 2015

@petromir temporary solution:

  1. Create pom.xml like this
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <groupId>test</groupId>
       <artifactId>test</artifactId>
       <version>1.0-SNAPSHOT</version>
       <packaging>jar</packaging>
       <dependencies>
<dependency>
    <groupId>com.qulice</groupId>
    <artifactId>qulice-ant</artifactId>
    <version>0.12.1</version>
</dependency>
       </dependencies>
</project>
  1. Execute from command line mvn dependency:copy-dependencies and mvn dependency:build-classpath
  2. Result of this command is classpath string. It must be modified: a) remove ant-1.9.4.jar 2) add slf4j-jdk14-1.7.5.jar
  3. build.xml must be without classpath
<project name="Qulice" basedir="." default="qulice">
    <taskdef name="qulice"
             classname="com.qulice.ant.QuliceTask">
    </taskdef>
    <target name="qulice" description="Execute qulice checks">
        <property name="license" value="LICENSE.txt"/>
        <qulice srcdir="${basedir}/src/main/java" classesdir="${basedir}/out/production"
                classpath="${basedir}/lib/dependencies;${basedir}/out/production">
        </qulice>
    </target>
</project>
  1. start ant with command ant -v -lib "classpath from 3)"

@petromir
Copy link
Author

petromir commented Feb 7, 2015

This did the job, but it's a temporary solution!

I have few remarks about the entire solution:

  • Wouldn't it be better if qulice-ant-{version}.jar contains all of its dependencies.
  • An Ant user doesn't care about Maven and qulice-ant-{version}.jar should be easily downloaded for some central place (I suppose once you release the official version, it will go to Maven Central, so it will be accessible)

In my opinion the process should be as follows:

  • Download qulice-ant-{version}.jar
  • Copy Ant configuration from the provided example and set the proper paths.
  • Run your build.xml and you have qulice working..

Looking forward for the final solution.

@alevohin
Copy link

alevohin commented Feb 7, 2015

@petromir My suggestion - create new issue and close this one (read http://www.yegor256.com/2009/03/04/pdd.html) because temporary solution works, Yes, it's temporary and it's normal. We can improve it for a long time, but it must be new tasks according to PDD principles.

@davvd
Copy link

davvd commented Feb 9, 2015

@alevohin this task is in your hands for 16 days already

-30 added to your rating, current score is: +810

@petromir
Copy link
Author

petromir commented Feb 9, 2015

@alevohin based on the article I don't see any 'numerous unknowns' that stops you to finish the issue in a way that will be more convenient for usage. @yegor256 & @davvd please advise!

Anyway if you all agree that the solution covers your quality requirements, I'm ready to close the issue when the documentation reflects the workaround.

@davvd
Copy link

davvd commented Feb 13, 2015

@alevohin this task is not yours any more (took too long), please stop. I'll give you something else... -60 to your rating, your total score is +780

@yegor256
Copy link
Owner

@davvd let's assign @alevohin back to this task, even though it's over time

@yegor256
Copy link
Owner

@alevohin take a look at this article: http://www.yegor256.com/2015/02/12/top-down-design.html What do you think?

@davvd
Copy link

davvd commented Feb 16, 2015

@davvd let's assign @alevohin back to this task, even though it's over time

@yegor256 yes, @alevohin is already assigned to this task, please go ahead!

@alevohin
Copy link

@yegor256 I think you mean top-leveled issues like this is better to resolve in way like #339 - implement at first external API and proper packaging.

My suggestion for current situation is to use @petromir advice:

  • update pom.xml (there are some dependency's lack)
  • pack qulice-ant-{version}.jar containing all of its dependencies
  • update documentation
  • release it and deploy to maven central repository

@yegor256 what do you think?

@yegor256
Copy link
Owner

@alevohin I have nothing against this plan

@alevohin
Copy link

@davvd this issue is blocked by #403

@davvd
Copy link

davvd commented Feb 23, 2015

@davvd this issue is blocked by #403

@alevohin of course, let's wait for #403

@petromir
Copy link
Author

Any news and/or progress?

@alevohin
Copy link

alevohin commented Apr 7, 2015

@petromir we are waiting for #403 here.

@krzyk
Copy link
Collaborator

krzyk commented Nov 3, 2015

@davvd this is postponed

@davvd davvd added the postponed label Nov 3, 2015
@davvd
Copy link

davvd commented Nov 3, 2015

@davvd this is postponed

@krzyk thanks, I added "postponed" label

@davvd
Copy link

davvd commented Nov 3, 2015

@davvd this is postponed

@krzyk right, I will find someone else, no problem

@petromir
Copy link
Author

@davvd & @krzyk I don't need this anymore. You can close if you don't want to spend time on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants