public void execute()

in core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/InstanceofMojo.java [81:130]


    public void execute() throws MojoExecutionException, MojoFailureException {
        Class type;
        try {
            getLog().info("[MAVEN-CORE-IT-LOG] Loading class " + className);
            type = getClass().getClassLoader().loadClass(className);
            getLog().info("[MAVEN-CORE-IT-LOG] Loaded class from " + type.getClassLoader());
        } catch (ClassNotFoundException e) {
            throw new MojoExecutionException("Failed to load type " + className, e);
        }

        Properties instanceofProperties = new Properties();

        if (objectExpressions != null && objectExpressions.length > 0) {
            Map contexts = new HashMap();
            contexts.put("project", project);
            contexts.put("pom", project);

            for (String expression : objectExpressions) {
                getLog().info("[MAVEN-CORE-IT-LOG] Evaluating expression " + expression);
                Object object = ExpressionUtil.evaluate(expression, contexts).get(expression);
                getLog().info("[MAVEN-CORE-IT-LOG] Checking object " + object);
                if (object != null) {
                    getLog().info("[MAVEN-CORE-IT-LOG]   Loaded class "
                            + object.getClass().getName());
                    getLog().info("[MAVEN-CORE-IT-LOG]   Loaded class from "
                            + object.getClass().getClassLoader());
                }
                instanceofProperties.setProperty(
                        expression.replace('/', '.'), Boolean.toString(type.isInstance(object)));
            }
        }

        if (components != null && !components.isEmpty()) {
            for (Object object : components) {
                getLog().info("[MAVEN-CORE-IT-LOG] Checking component " + object);
                getLog().info("[MAVEN-CORE-IT-LOG]   Loaded class "
                        + object.getClass().getName());
                getLog().info("[MAVEN-CORE-IT-LOG]   Loaded class from "
                        + object.getClass().getClassLoader());
                instanceofProperties.setProperty(
                        object.getClass().getName(), Boolean.toString(type.isInstance(object)));
            }
        }

        getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + instanceofPropertiesFile);

        PropertiesUtil.write(instanceofPropertiesFile, instanceofProperties);

        getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + instanceofPropertiesFile);
    }